3 ms·
Okay, this is really neat design. I went to check whether if..else works in an expression context and it does: fn five() -> i32 { let a = if (true)
by notpushkin 2y ago
Okay, this is really neat design. I went to check whether if..else works in an expression context and it does:
fn five() -> i32 {
let a = if (true) { 3 } else { 6 };
return a + 2;
}
Pure fun!
- masklinn 2y agoYa if you want fun match/case also works like that. And though for abs while don’t (they always return ()) `loop` itself does, you can `break` with a value and that’s what comes out the loop.