0

How to write short if condition ?

i want to know how to write short if condition ?

16th Apr 2017, 3:14 PM
Omar Abdel Rhman ☯
Omar Abdel Rhman ☯ - avatar
4 Answers
+ 3
x == 3 && function() -- function will be called only if x == 3, also you have ternary operator: var y = ( x == 3 ? "yes" : "no");
16th Apr 2017, 3:19 PM
Aleksandar
Aleksandar - avatar
+ 8
he means ternary operator condition?true_then_option:false_then_option; like x==1?cout<<'a':cout<<'b' in dis if x will b equal to 1 then 'a' will b printed else 'b' will b printed
16th Apr 2017, 3:26 PM
Ronit Kumar
Ronit Kumar - avatar
+ 5
Here its very short If(//some condition){ //do something }
16th Apr 2017, 3:18 PM
Shraddha
Shraddha - avatar
+ 1
thanks @Aleksandar
2nd May 2017, 2:06 AM
Omar Abdel Rhman ☯
Omar Abdel Rhman ☯ - avatar