Loops/Infinite: Difference between revisions
< Loops
Content added Content deleted
(→{{header|Java}}: Syntax highlighting, added infinite for) |
(Made into a task) |
||
Line 1: | Line 1: | ||
⚫ | |||
==Perform the same series of actions indefinitely.== |
|||
⚫ | |||
=={{header|Ada}}== |
=={{header|Ada}}== |
Revision as of 12:52, 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
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