if statements in rust code example
Example 1: if else Rust
// pratical example of if/else in rust
if n > 1 {
println!("It's greater");
} else if n == 1 {
println!("It's equal");
} else {
println!("It's minor");
}
Example 2: if in rust
if <boolean expression> {
print!("result from expression is true");
}
else {
print!("result from expression is false");
}