japl/tests/japl/ifchain.jpl

27 lines
452 B
Plaintext

//[Test: ifchain]
//[source: mixed]
fun printInt(x) {
if (x == 1)
print("one");
else if (x == 2)
print("two");
else if (x == 3)
print("three");
else if (x == 4)
print("four");
else if (x == 5)
print("five");
else if (x == 6)
print("six");
}
var x = 3;
printInt(x);//stdout:three
x = 5;
printInt(x);//stdout:five
x = 7;
printInt(x);
x = 1;
printInt(x);//stdout:one
//[end]
//[end]