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

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.
Maybe "block oriented" is supposed to mean "has blocks that are expressions".
Sorry, “expression-oriented” was what I meant to write.