The Is Less Than Comparison Operator checks whether the left value is smaller than the right value. This operator evaluates to True if the left value is less than the right value, and False otherwise. It works with Integer and Float types, but cannot mix different numeric types.
The short syntax structure uses the < symbol:
VALUE < VALUEThe long syntax structure uses the words IS LESS THAN:
VALUE IS LESS THAN VALUEPRINTLN 5 < 10 // Displays "TRUE"
PRINTLN 10 < 5 // Displays "FALSE"
PRINTLN 5 < 5 // Displays "FALSE"PRINTLN 2.5 < 3.7 // Displays "TRUE"
PRINTLN 5.0 < 2.0 // Displays "FALSE"
PRINTLN 3.14 < 3.14 // Displays "FALSE"PRINTLN -5 < 0 // Displays "TRUE"
PRINTLN -10 < -5 // Displays "TRUE"
PRINTLN 0 < -5 // Displays "FALSE"NEW INT x = 10
NEW INT y = 20
NEW INT z = 10
PRINTLN x < y // Displays "TRUE"
PRINTLN y < x // Displays "FALSE"
PRINTLN x < z // Displays "FALSE"NEW FLOAT temp1 = 98.6
NEW FLOAT temp2 = 100.0
NEW BOOL isCooler = temp1 < temp2
PRINTLN isCooler // Displays "TRUE"NEW INT age = 17
NEW BOOL isMinor = age < 18
PRINTLN isMinor // Displays "TRUE"The Is Less Than operator is commonly used in If statements to check numeric thresholds.
NEW INT age = 16
IF age < 18
PRINTLN "Access denied: Must be 18 or older"
ELSE
PRINTLN "Access granted"
END IF
// Displays "Access denied: Must be 18 or older"NEW FLOAT temperature = 32.0
IF temperature < 32.0
PRINTLN "Below freezing"
ELIF temperature < 50.0
PRINTLN "Cold"
ELSE
PRINTLN "Moderate or warm"
END IF
// Displays "Cold"NEW INT score = 75
IF score < 60
PRINTLN "Grade: F"
ELIF score < 70
PRINTLN "Grade: D"
ELIF score < 80
PRINTLN "Grade: C"
ELIF score < 90
PRINTLN "Grade: B"
ELSE
PRINTLN "Grade: A"
END IF
// Displays "Grade: C"The Is Less Than operator is frequently used to control loop iterations.
NEW INT i = 1
WHILE i < 5
PRINTLN "Count: " .. i
SET i = i + 1
END WHILE
// Displays: Count: 1, Count: 2, Count: 3, Count: 4NEW INT value = 0
WHILE value < 10
SET value = value + 2
PRINTLN "Value: " .. value
END WHILE
// Displays: Value: 2, Value: 4, Value: 6, Value: 8, Value: 10NEW INT fuel = 100
WHILE fuel < 100
PRINTLN "Fuel level: " .. fuel
SET fuel = fuel + 10
END WHILE
PRINTLN "Tank full"NEW INT x = 10
NEW INT y = 5
NEW BOOL result = ( x + y ) < 20
PRINTLN result // Displays "TRUE" ( 15 < 20 )NEW INT total = 100
NEW INT parts = 3
NEW BOOL isSmall = ( total / parts ) < 40
PRINTLN isSmall // Displays "TRUE" ( 33 < 40 )NEW INT a = 5
NEW INT b = 3
NEW INT c = 10
NEW BOOL comparison = ( a + b ) < ( c * 2 )
PRINTLN comparison // Displays "TRUE" ( 8 < 20 )NEW INT value = 15
NEW BOOL inRange = ( value < 20 ) && ( value < 50 )
PRINTLN inRange // Displays "TRUE"NEW FLOAT temperature = 25.0
NEW BOOL isCold = ( temperature < 10.0 ) || ( temperature < 15.0 )
PRINTLN isCold // Displays "FALSE"NEW INT age = 16
NEW BOOL hasPermission = FALSE
NEW BOOL canEnter = ( age < 18 ) && hasPermission
PRINTLN canEnter // Displays "FALSE"NEW INT stock = 5
NEW INT minStock = 10
IF stock < minStock
PRINTLN "Warning: Low stock level"
ELSE
PRINTLN "Stock level adequate"
END IF
// Displays "Warning: Low stock level"NEW INT speed = 45
NEW INT speedLimit = 50
IF speed < speedLimit
PRINTLN "Within speed limit"
ELSE
PRINTLN "Speeding!"
END IF
// Displays "Within speed limit"NEW INT a = 25
NEW INT b = 18
NEW INT minimum = 0
IF a < b
SET minimum = a
ELSE
SET minimum = b
END IF
PRINTLN "Minimum value: " .. minimum
// Displays "Minimum value: 18"NEW INT completed = 7
NEW INT total = 10
IF completed < total
PRINTLN "Progress: " .. completed .. "/" .. total .. " - Not complete"
ELSE
PRINTLN "All tasks completed!"
END IF
// Displays "Progress: 7/10 - Not complete"NEW INT x = 10
NEW INT y = 10
PRINTLN x < y // Displays "FALSE" ( 10 is not less than 10 )NEW INT score = 80
// Wrong for inclusive threshold
IF score < 80
PRINTLN "Below threshold"
END IF
// Correct for inclusive threshold
IF score <= 80
PRINTLN "At or below threshold"
END IF
// Displays "At or below threshold"NEW INT x = 5
NEW FLOAT y = 10.0
PRINTLN x < y // Type error! Cannot mix Integer and FloatNEW STR name1 = "Alice"
NEW STR name2 = "Bob"
PRINTLN name1 < name2 // Type error! Cannot compare Strings with <NEW BOOL a = TRUE
NEW BOOL b = FALSE
PRINTLN a < b // Type error! Cannot compare Booleans with <NEW INT age = 18
IF age < 18 // FALSE when age is exactly 18
PRINTLN "Under 18"
END IF
// Use <= for inclusive check
IF age <= 18
PRINTLN "18 or under"
END IF
// Displays "18 or under"