Short-circuit evaluation: Difference between revisions
m
→{{header|Ecstasy}}
mNo edit summary |
|||
Line 1,231:
<syntaxhighlight lang="java">
module test {
@Inject Console console;
static Boolean show(String name, Boolean value) {
console.print($"{name}()={value}");
return value;
void run() {
val a = show("a", _);
val b = show("b", _);
for (Boolean v1 : False..True) {
for (Boolean v2 : False..True) {
console.print($"a({v1}) && b({v2}) == {a(v1) && b(v2)}");
console.print();
console.print($"a({v1}) || b({v2}) == {a(v1) || b(v2)}");
console.print();
}
}
}
}
</syntaxhighlight>
|