Loops/Infinite: Difference between revisions
< Loops
Content added Content deleted
No edit summary |
m (→{{header|Ada}}: Added syntax highlighting) |
||
Line 2: | Line 2: | ||
=={{header|Ada}}== |
=={{header|Ada}}== |
||
< |
<ada>loop |
||
Put_Line("SPAM"); |
Put_Line("SPAM"); |
||
end loop;</ |
end loop;</ada> |
||
=={{header|C}}== |
=={{header|C}}== |
Revision as of 18:12, 11 April 2008
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
<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"); }
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
while true ; do echo "YES" ; done