0
What is the difference between if and else statement in C++
3 Answers
+ 1
if and else is a conditional statement, which executes when certain condition is met.
eg:
int x = 6;
if (x>5) {
cout << "hello";
}
else {
cout<< "hi";
}
//outputs hello
+ 1
Else needs an If statement before it, but an if statement works alone. If your condition in the if statement if false the else block will be executed:
if (condition) {
code;
}
else { //if the condition of the if before is false the else block will be executed
code;
}
0
i am new in solo learn i am just in 8 th standard is it difficult for me or not to learn python anyone tell