What happens if we we use while(-1) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What happens if we we use while(-1)

Does the condition execute or not

25th Apr 2018, 8:15 AM
Manish Gurbani
Manish Gurbani - avatar
4 Answers
+ 5
Why don't you try using it and see what happens
25th Apr 2018, 8:19 AM
Koushik Naskar
Koushik Naskar - avatar
0
iirc anything that isn't 0 is true, so it should execute. you should run the code and check it yourself though
25th Apr 2018, 1:18 PM
hinanawi
hinanawi - avatar
0
Koushik Naskar Thanks brother.. I was having my personal interview in a few mins when I asked this question.. Your answer really helped.. In those 5 mins I wrote a mf code and ran it.. -_-
9th Jun 2018, 7:32 AM
Manish Gurbani
Manish Gurbani - avatar
0
hinanawi Thank you so much.. Your answer helped me..
9th Jun 2018, 7:33 AM
Manish Gurbani
Manish Gurbani - avatar