Logo

Programming-Idioms

History of Idiom 2 > diff from v22 to v23

Edit summary for version 23 by :
[Perl] Alternative impl -> created new impl 1200

Version 22

2016-01-08, 09:04:19

Version 23

2016-01-08, 09:05:07

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
print "Hello\n" for 1 .. 10;

# Recent (5.10 and later) versions of perl also provide the
# say function, which automatically adds the newline
say "Hello" for 1 .. 10;
Code
print "Hello\n" for 1 .. 10;
Comments bubble
Note the necessary newline (\n), not to print every time on the same line
Comments bubble
Note the necessary newline (\n), not to print every time on the same line