New course! Every coder should learn Generative AI!
Try a free lesson0
Explain what's wrong in this if else loop
#include <iostream> using namespace std; int main() { int x=9; if(x=10) { cout <<"WTF??"; } else cout <<"OKAY"; return 0; } //output WTF??
3 Answers
+ 9
It should be
if(x==10)
Not if(x=10)
+ 2
@Boris Sundic is right, but accessory, the 'if/else' statement isn't at all a loop: loops are 'for' and 'while' statements, as 'if/else' structure doesn't provide any repetition when it run ^^
0
sorry my mistake 😶