Mako/tests/test.mako
2025-05-06 18:13:24 -05:00

88 lines
1.7 KiB
Mako

x = 10
result = if x > 5 then "greater" else "smaller" end
echo result
if x == 10 and x < 20 then
echo "x is ten and less than 20"
end
if x < 20 or x == 5 then
echo "x is either less than 20 or equals 5"
end
if not (x < 5) then
echo "x is not less than 5"
end
if x < 5 then
echo "x is small"
elseif x < 15 then
echo "x is medium"
elseif x < 25 then
echo "x is large"
else
echo "x is very large"
end
if x < 20 and x > 5 then
echo "x is between 5 and 20"
x = x + 1
else
echo "x is not between 5 and 20"
x = x - 1
end
a = 5
b = 10
c = 15
if a < b and b < c then
echo "a < b < c - values are in ascending order"
end
if a > 10 or b > 5 then
echo "either a > 10 or b > 5 (or both)"
end
if not (a == b) then
echo "a is not equal to b"
end
if (a < b and b < c) or (a == 5 and c == 15) then
echo "Complex condition is true"
end
if a > b and b > c then
echo "Descending order"
elseif a < b and b < c then
echo "Ascending order"
elseif a == b and b == c then
echo "All equal"
else
echo "No specific order"
end
scores = {
math = if x > 10 then "excellent" else "good" end,
science = "passing"
}
echo "math score: " + scores["math"]
echo "science score: " + scores["science"]
if a < b and b < c then
if a > 0 and c < 20 then
echo "a is positive, less than b, and c is less than 20"
else
echo "a is less than b, but either a is not positive or c >= 20"
end
end
if not (a < 0) and not (b > 20) then
echo "Both a is not negative and b is not greater than 20"
end
test1 = if a > 0 and b < 5 then "yes" else "no" end // Should be "no" (short-circuits on second condition)
test2 = if a < 0 or b > 5 then "yes" else "no" end // Should be "yes" (short-circuits on second condition)
echo "Test1: " + test1
echo "Test2: " + test2