Logo

Programming-Idioms

History of Idiom 2 > diff from v4 to v5

Edit summary for version 5 by :

Version 4

2015-08-18, 14:56:48

Version 5

2015-08-18, 15:04:34

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Code
for _ in 0..10 { println!("Hello"); }
Code
for _ in 0..10 { println!("Hello"); }
Comments bubble
0..10 syntax creates range iterator.

You can leave out variable name with underscore if you do not want to use it.