This language bar is your friend. Select your favorite languages!

Idiom #2 Print Hello 10 times

Loop to execute some code a constant number of times

Illustration
1
replicateM_ 10 $ putStrLn "Hello"
1
with Ada.Text_IO;
use Ada.Text_IO;
for I in 1 .. 10 loop
  Put_Line ("Hello");
end loop;
int i;
for(i=0;i<10;i++)
  printf("Hello\n");
(dotimes [_ 10]
  (println "Hello"))
#include <iostream>
using namespace std;
for(int i=0;i<10;i++)
  cout << "Hello\n";
for (int i=0 ; i<10 ; i++)
{
  System.Console.WriteLine("Hello!");
}
import std.stdio
foreach(i; 0..10)
	writeln("Hello");
import std.stdio : writeln;
import std.range : iota;
import std.algorithm.iteration : each;
iota(0,10).each!(a => "Hello".writeln);
for (var i = 0; i < 10; i++) { 
  print("Hello");
} 
1
for _ <- 1..10, do: IO.puts "hello"
lists:foreach(
  fun(_) ->
    io:format("Hello~n")
  end, lists:seq(1, 10)).
import "fmt"
for i:=0 ; i<10 ; i++ {
	fmt.Println("Hello")
}
for(var i=0;i<10;i++)
	console.log("Hello");
-1
for(int i=0;i<10;i++)
  System.out.println("Hello");
(dotimes (x 10)
	(write-line "Hello"))
for i=1, 10 do
	print('Hello')
end
for (int i=0;i<10;i++){
NSLog(@"Hello world");
}
for($i=0;$i<10;$i++)
  echo "Hello\n";
1
var
  i: integer;
begin
  for i:=1 to 10 do
    WriteLn('Hello');
end;
print "Hello\n" for 1 .. 10;
say "Hello" for 1 .. 10;
print("Hello"*10)
2
for i in range(10):
    print "Hello"
1
10.times { p 'Hello' }
1
10.times do
  puts "Hello"
end
for _ in 0..10 { println!("Hello"); }
(0 until 10).foreach( _ => println("Hello"))
(define (hellos i)
        (if (> i 0)    
            (begin
                (display "Hello")
                (newline)
                (hellos (- i 1)))))
(hellos 10)

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms.org