Hello World!
Hello World!
+ Hello World! x 5
R
# 1x
writeLines("Hello World!")
# 5x
for (i in rep("Hello World!", 5)) {
writeLines(i)
}
# 5x functional
library(purrr)
rep("Hello World!", 5) %>%
walk(writeLines)
Python
# Python 3
# 1x
print("Hello World!")
# 5x
for i in range(5):
print("Hello World!")
# 5x functional
from toolz import pipe
pipe("Hello World!\n", lambda i: i * 5, print)
SAS
/* 1x */
data _null_;
file stdout ;
put "Hello World!";
run;
/* 5x */
data _null_;
file stdout ;
do i = 1 to 5;
put "Hello World!";
end;
run;
/* 1x - macro language writing to the log */
%put "Hello World!";
/* 5x - macro language writing to the log */
%macro helloworld;
%do i = 1 %to 5;
%put "Hello World!";
%end;
%mend;
%helloworld;
/* 1x - obfuscated */
data _null_;
array letter {6} $1.;
i = 0;
do x = 72, 101, 108, 108, 111, 33;
i + 1;
letter {i} = byte(x);
end;
greeting = cats(of letter:);
putlog greeting;
run;
Bash
echo "1x"
echo "Hello World!"
echo "5x"
for i in {1..5} do
echo "Hello World!"
done
Awk
echo "1x"
awk 'BEGIN { print "Hello World!" }'
echo "5x"
awk 'BEGIN { for (i=0; i<=5; i++) print "Hello World!" }'
Racket
#lang racket
; 1x
(print "Hello World!")
; 5x
(for-each (lambda (i)
(printf "Hello World!\n"))
(stream->list (in-range 5)))
PowerShell
# 1x
Write-Host "Hello World!"
# 5x - full
1..5 | ForEach-Object { Write-Host "Hello World!" }
# 5x - abbreviated where % is an alias for ForEach-Object
1..5 | % { Write-Host "Hello World!" }