+ 4

simce it says i = 5 and then while true i = i-1 doesent that mean that when i =4 it wont be 5 and therefore false?

17th Dec 2016, 8:44 PM
Δημητρης Φρεντσελ
Δημητρης Φρεντσελ - avatar
3 odpowiedzi
+ 6
Could you show us the code? If the code is like this: i = 5 while(True) i = i - 1 This will run "forever" because the while condition will never become false. This while loop needs a break statement.
17th Dec 2016, 10:02 PM
Jafca
Jafca - avatar
0
thanks
17th Dec 2016, 10:05 PM
Δημητρης Φρεντσελ
Δημητρης Φρεντσελ - avatar
- 1
No. The loop will return true forever if the above code is true
25th Jan 2017, 8:51 PM
Bryan
Bryan - avatar