0
Can anybody explain me while if inside a function? How it works
3 Answers
+ 7
To get help from the community, you should put your code in playground and link it here. Thanks!
+ 1
Use of nested `while` loop, `if` inside `while` loop, or something else? I don't get what you mean by "while if inside a function", maybe you could edit the question title to clarify your intention.
+ 1
Basically if inside infinite while is used to break the loop. Let say you have written below code,
Count = 1
while True:
Count += 1
Above code will run till is reaches to maximum values the count can store.
Now if you want to come out of the while loop when count value is 50 then you can use if break as below.
Count = 1
while True:
If Count == 50:
break
Count += 1