mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
EMERGENCY: Computer is dying, this is an incomplete commit, do not use
This commit is contained in:
66
tests/integrations/test_keyword_if_then_else.toy
Normal file
66
tests/integrations/test_keyword_if_then_else.toy
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
//literals
|
||||
if (true) {
|
||||
print "Success";
|
||||
}
|
||||
else {
|
||||
print "Failure";
|
||||
}
|
||||
|
||||
//false literals
|
||||
if (false) {
|
||||
print "Failure";
|
||||
}
|
||||
else {
|
||||
print "Success";
|
||||
}
|
||||
|
||||
//conditionals
|
||||
if (1 < 2) {
|
||||
print "Success";
|
||||
}
|
||||
if (1 > 2) {
|
||||
print "Failure";
|
||||
}
|
||||
|
||||
|
||||
//variables
|
||||
var a = 42;
|
||||
|
||||
if (a) {
|
||||
print "Success";
|
||||
}
|
||||
else {
|
||||
print "Failure";
|
||||
}
|
||||
|
||||
|
||||
if (a == 42) {
|
||||
print "Success";
|
||||
}
|
||||
else {
|
||||
print "Failure";
|
||||
}
|
||||
|
||||
//concatenated strings
|
||||
if ("foo" .. "bar" == "foobar") {
|
||||
print "Success";
|
||||
}
|
||||
else {
|
||||
print "Failure";
|
||||
}
|
||||
|
||||
|
||||
if ("foobar" == "foo" .. "bar") {
|
||||
print "Success";
|
||||
}
|
||||
else {
|
||||
print "Failure";
|
||||
}
|
||||
|
||||
if ("fizz" .. "le" == "fi" .. "zzle") {
|
||||
print "Success";
|
||||
}
|
||||
else {
|
||||
print "Failure";
|
||||
}
|
||||
Reference in New Issue
Block a user