Conditions
fn f(x: Integer) {
if x == 5 or x == 4 {
return "match";
} else if x > 0 and x < 4 {
return "no match";
} else {
return "invalid";
}
}
std::print(f(5)); // prints "match"
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
fn f(x: Integer) {
if x == 5 or x == 4 {
return "match";
} else if x > 0 and x < 4 {
return "no match";
} else {
return "invalid";
}
}
std::print(f(5)); // prints "match"