Login
|
Signup
langref.org
-
python
and
erlang
add..
all
clojure
cpp
csharp
fantom
fsharp
go
groovy
haskell
java
ocaml
perl
php
ruby
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Structure
Loops
Perform an action a fixed number of times (FOR)
Display the string
"Hello"
five times like
"HelloHelloHelloHelloHello"
python
print "Hello" * 5
print "Hello" * 5
python
for i in range(5):
print "Hello"
for i in range(5):
print "Hello"
erlang
dotimes(5, fun () -> io:format("Hello") end).
-module(dotimes).
-export([start/0]).
start() ->
dotimes(5, fun () -> io:format("Hello") end).
dotimes(0, _) -> true;
dotimes(N, Action) -> Action(), dotimes(N - 1, Action).
erlang
lists:foreach(fun (_) -> io:format("Hello") end, lists:seq(1, 5)).
-module(dotimes).
-export([start/0]).
start() ->
lists:foreach(fun (_) -> io:format("Hello") end, lists:seq(1, 5)).
Submit a new solution for
python
or
erlang
There are 33 other solutions in
additional
languages (
clojure
,
cpp
,
csharp
,
fantom
...)