blob: ff97e94f163fb4b7e350300b44579946c0375017 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
% if
<small>There is a new edition of the book and this is an old link.</small>
> An `if` expression allows us to branch our code depending on conditions.
```rust
fn main() {
let number = 3;
if number < 5 {
println!("condition was true");
} else {
println!("condition was false");
}
}
```
---
You can find the latest version of this information
[here](ch03-05-control-flow.html#if-expressions).
|