From a9db9e14c0ad266d0403cd666afbbd8612ae28f3 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Sun, 25 Aug 2024 15:10:51 +0000 Subject: [PATCH] Update Examples --- Examples.md | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/Examples.md b/Examples.md index 975980e..6c2cad3 100644 --- a/Examples.md +++ b/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 +``` + + +#### loop + + + + + + +
RustHusht
+ +``` +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; + } +} +``` + + +``` +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; + + ```