iOS Swift Collections and Control Flow Control Flow With Loops While and Repeat While

hyndavi Uppala
hyndavi Uppala
1,710 Points

control flow in loops

what happens if we give the increment statements before the print statement in a while loop. sometimes it is going into an infinite loop and sometimes it is giving an error

KRIS NIKOLAISEN
KRIS NIKOLAISEN
53,388 Points

Can you provide your code?

hyndavi Uppala
hyndavi Uppala
1,710 Points

var x = 0 while x <= 20 {

x += 1
print(x)

}