implementing jumping back and forth (ch23)

This commit is contained in:
2024-08-27 12:47:40 +02:00
parent 34a40813f7
commit 9de028d09c
9 changed files with 148 additions and 3 deletions

7
samples/ch23_if.lox Normal file
View File

@ -0,0 +1,7 @@
if (true) {
print "first is true!";
}
if (false) {
print "second if false!";
}

13
samples/ch23_if_else.lox Normal file
View File

@ -0,0 +1,13 @@
var a = 1;
if (a == 1) {
print "first is true!";
} else {
print "first is false!";
}
if (a == 2) {
print "second is false!";
} else {
print "second is false!";
}

View File

@ -0,0 +1,31 @@
print "and...";
if (true and true) {
print "should show";
}
if (true and false) {
print "should not show";
}
if (false and true) {
print "should not show";
}
if (false and false) {
print "should not show";
}
print "or...";
if (true or true) {
print "should show";
}
if (true or false) {
print "should show";
}
if (false or true) {
print "should show";
}
if (false or false) {
print "should show";
}