Added short-circuiting support to && and ||

This commit is contained in:
2023-03-11 17:59:09 +11:00
parent 68ed52b347
commit f2f8aed23a
4 changed files with 21 additions and 6 deletions

View File

@@ -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";

View 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";

View File

@@ -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