Sequences and Looping¶
1..5 vs. range(5) (and “a”..”z”)
2 in range(5) (the in operator)
if else vs. if then
if “expressions” (Python doesn’t have this) var maxValue:Int = if (a > b) a else b but multiple lines (only the last value is used in the block)
when (aka switch)…Python doesn’t have this:
when (x) { !in 1..20 -> println(“x is 1”) 21,22 -> println(“x is 22 or 23”) else -> { // Some set of lines in a block println(“x is greater than 22”) } }
etc.
generators, iterators