How do for-in loops in swift work? -
i've used them, i'm familiar code , read number tutorials still don't understand how work in can't run through head i'm doing , want achieve, opposed if statement can read in english quite well.
for-loops
have been i've struggled through lack of understanding, can offer insight please?
the for-in loop performs set of statements each item in range or collection. swift provides 2 range operators a..<b
, a...b
, shortcut expressing range of values.
// prints 1-10 in 1...10 { print(i) } // way has been removed in swift 3 use above var = 1; <= 10; i+=1 { print(i) }
Comments
Post a Comment