Saving work pre-references
This commit is contained in:
38
tests/test_short_circuit.krak
Normal file
38
tests/test_short_circuit.krak
Normal file
@@ -0,0 +1,38 @@
|
||||
import io:*
|
||||
|
||||
fun is_true():bool {
|
||||
return true
|
||||
}
|
||||
|
||||
fun is_true_extra():bool {
|
||||
print("true_extra: ")
|
||||
return true
|
||||
}
|
||||
|
||||
fun is_false():bool {
|
||||
return false
|
||||
}
|
||||
|
||||
fun is_false_extra():bool {
|
||||
print("false_extra: ")
|
||||
return false
|
||||
}
|
||||
|
||||
fun main():int {
|
||||
println("early or")
|
||||
if (is_true() || is_false_extra())
|
||||
println("was true")
|
||||
println("early and")
|
||||
if (is_false() && is_true_extra())
|
||||
println("was false")
|
||||
println()
|
||||
println("late or")
|
||||
if (is_false_extra() || is_true())
|
||||
println("was true")
|
||||
println("late and")
|
||||
if (is_true_extra() && is_false())
|
||||
println("was false")
|
||||
println()
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user