Logo

Programming-Idioms

History of Idiom 256 > diff from v18 to v19

Edit summary for version 19 by norom:
[Rust] Add missing comment

Version 18

2021-08-23, 08:43:45

Version 19

2021-08-23, 08:47:22

Idiom #256 Count backwards

Print the numbers 5, 4, ..., 0 (included), one line per number.

Idiom #256 Count backwards

Print the numbers 5, 4, ..., 0 (included), one line per number.

Extra Keywords
countdown negative step reverse
Extra Keywords
countdown negative step reverse
Code
(0..=5).rev().for_each(|i| println!("{}", i));
Code
(0..=5).rev().for_each(|i| println!("{}", i));
Comments bubble
Use _(0..=5).rev()_.
(5..=0) will not do anything.