+ 2
Can i use if else without braces??
4 Answers
+ 10
yes you can but when there is only one state ment after it
eg.
if(condition) cout << "Hello World" << endl;
else cout << " hi" << endl;
// this is right when there is only one statement
but
if (condition) cout << "hello" << endl;
cout << " world" << endl;
// this is wrong as there are two statement it should be under braces {}
+ 3
Thanks
+ 1
yes if else statement can be implemented without using braces but only when there is single statement
+ 1
U can use but there may be more than 1 condition.... then only u can use without braces