langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,12 @@
// point of interest: the when keyword and && operator inside the macro definition are macros themselves
macro if2 (cond1, cond2, bodyTT, bodyTF, bodyFT, bodyFF)
syntax ("if2", "(", cond1, ")", "(", cond2, ")", bodyTT, "elseTF", bodyTF, "elseFT", bodyFT, "else", bodyFF)
{
<[
when($cond1 && $cond2) {$bodyTT};
when($cond1 && !($cond2)) {$bodyTF};
when(!($cond1) && $cond2) {$bodyFT};
when(!($cond1) && !($cond2)) {$bodyFF};
]>
}

View file

@ -0,0 +1,20 @@
using System;
using System.Console;
module UseIf2
{
Main() : void
{
def happy = true;
def knowit = false;
if2 (happy) (knowit)
Write("Clap hands")
elseTF
Write("You're happy")
elseFT
Write("Cheer up")
else
Write("You're unhappy, cheer up");
}
}