Assign from condition
This commit is contained in:
parent
462d440f1f
commit
03914257e0
@ -1,9 +1,10 @@
|
||||
fn main() {
|
||||
let number = 3;
|
||||
|
||||
if number < 5 {
|
||||
println!("condition was true");
|
||||
let condition = true;
|
||||
let number = if condition {
|
||||
5
|
||||
} else {
|
||||
println!("condition was false");
|
||||
}
|
||||
6
|
||||
};
|
||||
|
||||
println!("The value of number is: {}", number);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user