RosettaCodeData/Task/Short-circuit-evaluation/Pike/short-circuit-evaluation.pike
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

20 lines
366 B
Text

int(0..1) a(int(0..1) i)
{
write(" a\n");
return i;
}
int(0..1) b(int(0..1) i)
{
write(" b\n");
return i;
}
foreach(({ ({ false, false }), ({ false, true }), ({ true, true }), ({ true, false }) });; array(int) args)
{
write(" %d && %d\n", @args);
a(args[0]) && b(args[1]);
write(" %d || %d\n", @args);
a(args[0]) || b(args[1]);
}