0
How to write short if condition ?
i want to know how to write short if condition ?
4 Respuestas
+ 3
x == 3 && function() -- function will be called only if x == 3, also you have ternary operator:
var y = ( x == 3 ? "yes" : "no");
+ 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
+ 5
Here its very short
If(//some condition){
//do something
}
+ 1
thanks @Aleksandar