implementing jumping back and forth (ch23)
This commit is contained in:
7
samples/ch23_if.lox
Normal file
7
samples/ch23_if.lox
Normal 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
13
samples/ch23_if_else.lox
Normal 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!";
|
||||
}
|
31
samples/ch23_if_else_logical_operators.lox
Normal file
31
samples/ch23_if_else_logical_operators.lox
Normal 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";
|
||||
}
|
Reference in New Issue
Block a user