Logo

Programming-Idioms

History of Idiom 2 > diff from v39 to v40

Edit summary for version 40 by :
New Python implementation by user [myguel]

Version 39

2016-02-18, 08:11:39

Version 40

2016-02-18, 16:57:55

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;
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
Code
10.times do
	puts "Hello"
end
Code
10.times do
	puts "Hello"
end
Code
for(var i=0;i<10;i++)
	console.log("Hello");
Code
for(i=0;i<10;i++)
	console.log("Hello");