Loops/Infinite: Difference between revisions

Content added Content deleted
No edit summary
(Better D entry)
Line 168: Line 168:


=={{header|D}}==
=={{header|D}}==
Some common ways to create an infinite printing loop:
<lang d>while(1) writeln("SPAM") ;
<lang d>import std.stdio;


void main() {
do writeln("SPAM"); while(1);
while (true)
writeln("SPAM");
}</lang>


<lang d>import std.stdio;
for(;;) writeln("SPAM") ;


void main() {
l: writeln("SPAM"); goto l;
do
</lang>
writeln("SPAM");
while (true);
}</lang>

<lang d>import std.stdio;

void main() {
for (;;)
writeln("SPAM");
}</lang>

<lang d>import std.stdio;

void main() {
LOOP:
writeln("SPAM");
goto LOOP;
}</lang>


=={{header|dc}}==
=={{header|dc}}==