if (condition) { do_x() } else { do_y() }
That's the JavaScript version of what you wrote, and it's nearly identical. JavaScript doesn't require line breaks. if (condition) { do_x() } else { do_y() }
That's the JavaScript version of what you wrote, and it's nearly identical. JavaScript doesn't require line breaks. const x = cond1 ? a
: cond2 ? b
: c
becomes in Rust let x = if cond1 { a }
else if cond2 { b }
else { c }