5 ms·
If is an expression in a lot of languages. The syntax you describe is identical to the "ternary statement" in C-style languages.
by tarabukka 14y ago
If is an expression in a lot of languages. The syntax you describe is identical to the "ternary statement" in C-style languages.
- jeremiep 14y agoThe ternary is an expression, not a statement :) You can write: a = b ? c : d; in C/C++, you can't write a = if(b) { c; } else { d; }.
- tarabukka 14y agoOh, yeah. My mistake. Although what you describe is a lot more functional in style. You could probably emulate it in a language with higher-order functions.