Short-circuit evaluation: Difference between revisions

Content deleted Content added
Line 938: Line 938:
return v
return v
}
}

func b(v) {
func b(v) {
print(nameof(b), terminator: "")
print(nameof(b), terminator: "")
return v
return v
}
}

func test(i, j) {
func testMe(i, j) {
print("Testing a(\(i)) && b(\(j))")
print("Testing a(\(i)) && b(\(j))")
print("Trace: ", terminator: "")
print("Trace: ", terminator: "")
print("\nResult: \(a(i) && b(j))")
print("\nResult: \(a(i) && b(j))")

print("Testing a(\(i)) || b(\(j))")
print("Testing a(\(i)) || b(\(j))")
print("Trace: ", terminator: "")
print("Trace: ", terminator: "")
print("\nResult: \(a(i) || b(j))")
print("\nResult: \(a(i) || b(j))")

print()
print()
}
}

test(false, false)
testMe(false, false)
test(false, true)
testMe(false, true)
test(true, false)
testMe(true, false)
test(true, true)</lang>
testMe(true, true)</lang>


{{out}}
{{out}}