Loops/Infinite

From Rosetta Code
Revision as of 18:12, 11 April 2008 by rosettacode>Waldorf (→‎{{header|Ada}}: Added syntax highlighting)
Task
Loops/Infinite
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

<ada>loop

  Put_Line("SPAM");

end loop;</ada>

C

while(1) puts("SPAM");

Common Lisp

(loop (write-line "SPAM"))

Groovy

while (true) {
  println 'SPAM'
}

Haskell

forever (putStrLn "SPAM")

Java

while(true){
   System.out.println("SPAM");
}
for(;;){
   System.out.println("SPAM");
}

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

while true ; do echo "YES" ; done