From 5535f272c6a11a268296cb93901abe36fd7a17d0 Mon Sep 17 00:00:00 2001 From: Orestis <orestis.malaspinas@pm.me> Date: Thu, 7 Sep 2023 09:42:00 +0200 Subject: [PATCH] old and new control merged --- slides/src/control.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/slides/src/control.md b/slides/src/control.md index a284a42..fe5b816 100644 --- a/slides/src/control.md +++ b/slides/src/control.md @@ -30,6 +30,7 @@ fn main() { } else { 0 // pas de ; }; // attention au ; + println!("Le signe de x est {sign}."); } ``` @@ -37,10 +38,8 @@ fn main() { ```rust [] ignore fn main() { - let mut x = 0; loop { println!("En boucle!"); - x += 1; } } ``` @@ -87,12 +86,7 @@ fn main() { println!("Fin de la boucle!"); } ``` +- `0..10` de `0` à `10` non inclus. +- `0..10` est une `Range` (une collection). -## La boucle `for` ++ - -```rust ignore -for i in collection { - // instructions -} -``` -- GitLab