Loops/Infinite
< Loops
Loops/Infinite
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
Specifically print out "SPAM" followed by a newline in an infinite loop.
Ada
loop Put_Line("SPAM"); end loop;
C
while(1) puts("SPAM");
Common Lisp
(loop (write-line "SPAM"))
Groovy
while (true) { println 'SPAM' }
Haskell
forever (putStrLn "SPAM")
Java
<java>while(true){//anything that always evaluates to true is OK (1==1, for example)
System.out.println("SPAM");
}</java> Or: <java>for(;;){
System.out.println("SPAM");
} </java>
Logo
forever [print "SPAM]
Perl
while(1){print"SPAM\n"}
Prolog
repeat, write('SPAM'), nl, fail.
Python
while 1: print "SPAM"
Ruby
while true do puts "SPAM" end
UnixPipes
yes SPAM