On 01/22/2012 12:49 PM, Matt Soucy wrote:
On 01/22/2012 03:24 PM, bcs wrote:
On 01/20/2012 07:40 AM, Robert Clipsham wrote:
Just came across this amusing 4 minute video:

https://www.destroyallsoftware.com/talks/wat

Anyone have any other WATs you can do in other languages? Bonus points
for WATs you can do in D.


IIRC:

int i, j = getInt();
for (switch(j) {
case 0: i = 5; break;
case 1: i = 4; break;
default: i = 42; } i < 77; i++)
writefln("Wat!?");

Wat.
This managed to confuse me and most of the people around me. Especially
since it works.

http://www.d-programming-language.org/statement.html#ForStatement

Everything from after the '(' up to and including the first ';' is defined by use of an NoScopeNonEmptyStatement or ';' (the first happens to include variable decelerations, expression statements and if/for/switch/etc.).

Reply via email to