Loops/Infinite

From Rosetta Code
Revision as of 03:31, 11 April 2008 by rosettacode>Marshmallows (New page: ==Perform the same series of actions indefinitely.== Specifically print out "SPAM" followed by a newline in an infinite loop. =={{header|Ada}}== <pre language="ada">loop Put_Line("SPAM...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Perform the same series of actions indefinitely.

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 'groovy'
}

Haskell

forever (putStrLn "SPAM")

Java

while(true) {
   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