Short-circuit evaluation: Difference between revisions

m
(Updates to work with Nim 1.4: added missing parameter types. Did also some formatting and added a general comment.)
Line 935:
 
<lang dyalect>func a(v) {
print(nameof(a), terminator =: "")
return v
}
 
func b(v) {
print(nameof(b), terminator =: "")
return v
}
 
func test(i, j) {
print("Testing a(\(i)) && b(\(j))")
print("Trace: ", terminator =: "")
print("\nResult: \(a(i) && b(j))")
 
print("Testing a(\(i)) || b(\(j))")
print("Trace: ", terminator =: "")
print("\nResult: \(a(i) || b(j))")
 
print()
}
 
test(false, false)
test(false, true)
Anonymous user