mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Added short-circuiting support to && and ||
This commit is contained in:
@@ -23,5 +23,8 @@ assert !false, "!false";
|
||||
var c = false;
|
||||
assert !c, "!c";
|
||||
|
||||
//test multiple comparisons
|
||||
assert 1 == 2 == false, "Left-accociative equality failed";
|
||||
|
||||
|
||||
print "All good";
|
||||
|
||||
9
test/scripts/short-circuiting-support.toy
Normal file
9
test/scripts/short-circuiting-support.toy
Normal file
@@ -0,0 +1,9 @@
|
||||
//explicitly support && and || short circuits
|
||||
|
||||
assert 1 && 2 == 2, "&& short-circuit failed";
|
||||
|
||||
assert 1 || 2 == 1, "|| short-circuit failed";
|
||||
|
||||
|
||||
print "All good";
|
||||
|
||||
@@ -132,6 +132,7 @@ int main() {
|
||||
"panic-within-functions.toy",
|
||||
"polyfill-insert.toy",
|
||||
"polyfill-remove.toy",
|
||||
"short-circuiting-support.toy",
|
||||
"ternary-expressions.toy",
|
||||
"types.toy",
|
||||
NULL
|
||||
|
||||
Reference in New Issue
Block a user