Hacker News new | ask | show | jobs
by tarabukka 4914 days ago
If is an expression in a lot of languages. The syntax you describe is identical to the "ternary statement" in C-style languages.
1 comments

The 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; }.

Oh, 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.