0
How can I understand more harder while loop??
for example take this c++ code:- int x=0; while(0){ if(x<3){ x++; } cout << (x=='1')
5 Respostas
+ 1
You can shorten that and make it execute by...
while (x < 3) {
x++;
cout << (x == 1);
}
Also what do you not understand about while loops?
+ 2
the while loop in this example is not going to be run even one time
this while loop's condition is 0 which means false.
while(0) is equal to while(false)
when condition is false the loop do not run......
here loop will not run and it will go to
cout<<(x == '1')
which will print 0 because it is false that x=='1'
+ 2
thanks Alex for supporting me.
and i don't care if anyone downvote me. 😂😎
+ 1
Whoever downvoted @Raj Chhatrala:
He is right. The code in the body of a while(false) loop won't get executed.
0
I think he wanted to write while(!x)