Basics
Conditions
Use if and else to branch on a boolean.
fn Choose(value: bool) -> i32 {
if value {
return 42;
} else {
return 0;
}
}
fn main() -> i32 {
return Choose(true);
}terminal
hopper run demo src
The condition must be a boolean. A function that returns a value needs a return on every reachable path.