Y
Hacker News
new
|
ask
|
show
|
jobs
by
chrismorgan
3257 days ago
Block-oriented languages can do it; Rust, for example:
let result = if boolean_flag { do_this() } else { do_that() };
Rust actually
doesn’t have
a ternary operator.
1 comments
lmm
3257 days ago
What do you mean "block-oriented"? I'd say this is part of Rust's ML heritage, and comes of being expression-oriented: if is just an expression, and evaluates to a value like any other expression.
link
nerdponx
3257 days ago
Maybe "block oriented" is supposed to mean "has blocks that are expressions".
link
chrismorgan
3252 days ago
Sorry, “expression-oriented” was what I meant to write.
link