Listing 6.5 while loop (Need help pls!)


#1

Can someone run me through this?
Why does this give you an answer of 6,7,8,9,10 and
Why you put i += 1 after the print?

I think I’m thinking about this as a for in loop or something…

Thx Anyway

var myFirstInt: Int = 0
var i = 1
while i < 6 {
myFirstInt += 1
print(myFirstInt)
i += 1
}