Brain Gymnastics: Programming Language Keyword Abuse
To get to know a language a little better, this is a fun way to spend an hour.
Simply try and use all the keywords of a language of choice. Then try to reduce the code to contain each keyword as few times as possible. Also, try to remove as much as possible that isn't a keyword.
The code should run, and all paths should be executed.
This is my Javascript snippet containing all keywords only once (except "this" which occurs twice). Only one non-keyword is used -- the variable "e".
Have fun!
try {
do { var e; continue } while (void delete typeof null in undefined)
} catch(e) {
with(e)
if ((function(){
for (;;) break;
switch (true instanceof this){
case false:
default: throw new this
}
return
})());
else;
} finally {}