Update Examples
parent
544e19ff25
commit
a9db9e14c0
45
Examples.md
45
Examples.md
@ -807,7 +807,7 @@ fn main() {
|
||||
#![allow(unreachable_code, unused_labels)]
|
||||
|
||||
fn main
|
||||
'outer loop {
|
||||
'outer loop
|
||||
println! "Entered the outer loop"
|
||||
|
||||
'inner loop
|
||||
@ -863,5 +863,48 @@ fn main
|
||||
|
||||
|
||||
|
||||
```
|
||||
</td></tr></table>
|
||||
|
||||
#### loop
|
||||
<table>
|
||||
<tr>
|
||||
<th>Rust</th>
|
||||
<th>Husht</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
```
|
||||
fn main() {
|
||||
let mut n = 1;
|
||||
|
||||
while n < 21 {
|
||||
match () {
|
||||
_ if n % 15 == 0 => println!("fizzbuzz"),
|
||||
_ if n % 3 == 0 => println!("fizz"),
|
||||
_ if n % 5 == 0 => println!("buzz"),
|
||||
_ => println!("{}", n)
|
||||
}
|
||||
n += 1;
|
||||
}
|
||||
}
|
||||
```
|
||||
</td><td>
|
||||
|
||||
```
|
||||
fn main
|
||||
let mut n = 1
|
||||
|
||||
while n < 21
|
||||
cond
|
||||
n % 15 == 0 => println! "fizzbuzz"
|
||||
n % 3 == 0 => println! "fizz"
|
||||
n % 5 == 0 => println! "buzz"
|
||||
else println! "{}", n
|
||||
|
||||
n += 1;
|
||||
|
||||
|
||||
```
|
||||
</td></tr></table>
|
||||
|
Loading…
Reference in New Issue
Block a user