From c5c9103f1ff7c64c76aca145dff3c7466311d56c Mon Sep 17 00:00:00 2001 From: Bertram Scharpf Date: Tue, 30 Jun 2026 17:21:24 +0200 Subject: [PATCH] Better formatting --- src/flow_control/for.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/flow_control/for.md b/src/flow_control/for.md index e9fc3cf62b..456a14514e 100644 --- a/src/flow_control/for.md +++ b/src/flow_control/for.md @@ -46,19 +46,23 @@ fn main() { } ``` -Just remember that even though you can compile the code when a>b, the loop gets -never executed. +Just remember that even though you can compile the code when `a>b`, the loop +gets never executed. + ```rust,editable -for i in 10..1{ -println!("fizzbuzz"); +for i in 10..1 { + println!("fizzbuzz"); } ``` + If you want to count down, you need to use .rev() instead + ```rust,editable -for i in (1..10).rev(){ -println!("fizzbuzz"); +for i in (1..10).rev() { + println!("fizzbuzz"); } ``` + ## for and iterators The `for in` construct is able to interact with an `Iterator` in several ways.