+ 1
var myRange = 2..10
If we: println(myRange) Why don't we get the numbers separatively?
3 Respuestas
+ 8
Because that range is an abstraction of a range. For printing the numbers you have to iterate it. You could use this abstraction to check if a number is in the range too. Example:
var myRange = 2..10
for(i in myRange)
println(i)
println()
println(3 in myRange)
+ 7
You are welcome
+ 1
Thank you this helped me