Challenge on Russian Stack Overflow

Jack Applegame via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 11 00:29:11 PST 2016


I found funny (from my point of view) challenge in Russian Stack 
Overflow.
Any language accepted.

You need to make the loop
> for (int x=0; x<3; ++x) {}
endless.

Rules:
- you can't modify the loop's code itself;
- you can't modify the loop's variable inside the body of loop;
- you can't wrap the loop in an outer infinite loop or insert an 
infinite loop inside the body;

For example,  C++ solution:

> int main() {
>     #define int bool
>     for (int x=0; x<3; ++x);
>     return 0;
> }

This is my D solution - 
http://ru.stackoverflow.com/a/589748/218208

Solution with the highest rating wins.


More information about the Digitalmars-d mailing list