Problem Statement
How do you create a range in Kotlin?
Explanation
Kotlin uses the dot dot operator to create ranges like 1 dot dot 10 which includes both endpoints, or use until for exclusive end like 1 until 10 excluding 10. You can use step to specify increment like 1 dot dot 10 step 2 for odd numbers, or downTo for descending ranges like 10 downTo 1.
Ranges work with in operator for containment checks, with for loops for iteration, and with when expressions for matching. Character ranges like a dot dot z and custom ranges for your own types are also supported, making ranges a versatile feature for iteration and bounds checking.