0
What's the difference between "if", "and", and "do-while"?
9 Answers
+ 3
3 completely different things
"if' is a keyword for conditions.
"and" ? In C++, you use && for the AND operator.
"do-while" is a kind of loop. like the while loop abd the for loop
+ 3
'if' is used when you have to make 1 of 2 decision, like if(7>2){cout << "true";} else{cout << "false";}
"while" on the hand is used when you want to repeat a certain code block within the condition given. Note that the while loop takes only one condition unlike the "for" loop that must have three
+ 1
You use "if" when you need a condition.
You use "do-while" wheb you need a loop that turn at least one time
You use the AND operator wheb you want to a condition to verify two things
for example :
if ( (x > 0 ) && (x <= 10) ) {
cout << "X is between 0 and 10, 10 included";
}
+ 1
gud answers
0
i just wandering when "if" is used, when "and" is used, and when "while" used?
0
thanks a lot for your answer
0
If is a condition
While is a loop
In loop you can repeat the given condition
But in if statement it derives true or false condition
0
if is one time.. do while as many as you want..
0
I am learning something here.