The Is Greater Than Or Equal To Comparison Operator checks whether the left value is larger than or equal to the right value. This operator evaluates to True if the left value is greater than or equal to 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 GREATER THAN OR EQUAL TO:
VALUE IS GREATER THAN OR EQUAL TO VALUEPRINTLN 10 >= 5 // Displays "TRUE"
PRINTLN 5 >= 10 // Displays "FALSE"
PRINTLN 5 >= 5 // Displays "TRUE"PRINTLN 5.7 >= 2.5 // Displays "TRUE"
PRINTLN 2.0 >= 5.0 // Displays "FALSE"
PRINTLN 3.14 >= 3.14 // Displays "TRUE"PRINTLN 0 >= -5 // Displays "TRUE"
PRINTLN -5 >= -10 // Displays "TRUE"
PRINTLN -5 >= 0 // Displays "FALSE"
PRINTLN -5 >= -5 // Displays "TRUE"NEW INT x = 20
NEW INT y = 10
NEW INT z = 20
PRINTLN x >= y // Displays "TRUE"
PRINTLN y >= x // Displays "FALSE"
PRINTLN x >= z // Displays "TRUE"NEW FLOAT temp1 = 100.0
NEW FLOAT temp2 = 98.6
NEW FLOAT temp3 = 100.0
NEW BOOL isHotter = temp1 >= temp2
NEW BOOL isSame = temp1 >= temp3
PRINTLN isHotter // Displays "TRUE"
PRINTLN isSame // Displays "TRUE"NEW INT age = 18
NEW BOOL isAdult = age >= 18
PRINTLN isAdult // Displays "TRUE"The Is Greater Than Or Equal To operator is commonly used in If statements to check inclusive numeric thresholds.
NEW INT age = 18
IF age >= 18
PRINTLN "Access granted"
ELSE
PRINTLN "Access denied: Must be 18 or older"
END IF
// Displays "Access granted"NEW FLOAT temperature = 90.0
IF temperature >= 90.0
PRINTLN "Very hot"
ELIF temperature >= 70.0
PRINTLN "Warm"
ELSE
PRINTLN "Cool or cold"
END IF
// Displays "Very hot"NEW INT score = 90
IF score >= 90
PRINTLN "Grade: A"
ELIF score >= 80
PRINTLN "Grade: B"
ELIF score >= 70
PRINTLN "Grade: C"
ELIF score >= 60
PRINTLN "Grade: D"
ELSE
PRINTLN "Grade: F"
END IF
// Displays "Grade: A"The Is Greater Than Or Equal To operator is frequently used to control loop iterations with inclusive boundaries.
NEW INT i = 5
WHILE i >= 1
PRINTLN "Count: " .. i
SET i = i - 1
END WHILE
// Displays: Count: 5, Count: 4, Count: 3, Count: 2, Count: 1NEW INT value = 20
WHILE value >= 10
PRINTLN "Value: " .. value
SET value = value - 2
END WHILE
// Displays: Value: 20, Value: 18, Value: 16, Value: 14, Value: 12, Value: 10NEW INT timer = 5
WHILE timer >= 0
PRINTLN "Timer: " .. timer
SET timer = timer - 1
END WHILE
PRINTLN "Time's up!"
// Displays: Timer: 5, Timer: 4, Timer: 3, Timer: 2, Timer: 1, Timer: 0, Time's up!NEW INT x = 10
NEW INT y = 5
NEW BOOL result = ( x + y ) >= 15
PRINTLN result // Displays "TRUE" ( 15 >= 15 )NEW INT width = 5
NEW INT height = 5
NEW BOOL isLarge = ( width * height ) >= 25
PRINTLN isLarge // Displays "TRUE" ( 25 >= 25 )NEW INT a = 5
NEW INT b = 3
NEW INT c = 4
NEW BOOL comparison = ( a + b ) >= ( c * 2 )
PRINTLN comparison // Displays "TRUE" ( 8 >= 8 )NEW INT value = 15
NEW INT min = 10
NEW INT max = 20
NEW BOOL inRange = ( value >= min ) && ( value >= 5 )
PRINTLN inRange // Displays "TRUE"NEW INT score = 85
NEW BOOL isPassing = ( score >= 60 ) && ( score >= 50 )
PRINTLN isPassing // Displays "TRUE"NEW INT age = 25
NEW BOOL hasExperience = TRUE
NEW BOOL isQualified = ( age >= 21 ) && hasExperience
PRINTLN isQualified // Displays "TRUE"NEW INT credits = 120
NEW INT requiredCredits = 120
IF credits >= requiredCredits
PRINTLN "Eligible for graduation"
ELSE
PRINTLN "Need more credits"
END IF
// Displays "Eligible for graduation"NEW INT attendees = 100
NEW INT capacity = 100
IF capacity >= attendees
PRINTLN "Venue can accommodate all attendees"
ELSE
PRINTLN "Venue overcapacity"
END IF
// Displays "Venue can accommodate all attendees"NEW INT a = 25
NEW INT b = 18
NEW INT maximum = 0
IF a >= b
SET maximum = a
ELSE
SET maximum = b
END IF
PRINTLN "Maximum value: " .. maximum
// Displays "Maximum value: 25"NEW INT sales = 1000
NEW INT quota = 1000
IF sales >= quota
PRINTLN "Quota met! Bonus awarded."
ELSE
PRINTLN "Keep working toward quota"
END IF
// Displays "Quota met! Bonus awarded."The key difference is that Is Greater Than Or Equal To ( >= ) includes equal values, while Is Greater Than ( > ) does not.
NEW INT x = 10
NEW INT y = 10
PRINTLN x > y // Displays "FALSE" ( 10 is not greater than 10 )
PRINTLN x >= y // Displays "TRUE" ( 10 is equal to 10 )NEW INT score = 90
NEW INT minScore = 90
// Exclusive check ( wrong for this case )
IF score > minScore
PRINTLN "Above minimum"
END IF
// Inclusive check ( correct )
IF score >= minScore
PRINTLN "At or above minimum"
END IF
// Displays "At or above minimum"NEW INT x = 25
NEW INT y = 25
PRINTLN x >= y // Displays "TRUE" ( 25 is equal to 25 )NEW INT i = 5
NEW INT minValue = 1
WHILE i >= minValue
PRINTLN "Iteration " .. i
SET i = i - 1
END WHILE
// Displays: Iteration 5, Iteration 4, Iteration 3, Iteration 2, Iteration 1NEW INT userInput = 5
NEW INT minValue = 5
NEW INT maxValue = 10
IF ( userInput >= minValue ) && ( userInput <= maxValue )
PRINTLN "Valid input"
ELSE
PRINTLN "Input out of range"
END IF
// Displays "Valid input"NEW INT points = 60
IF points >= 60
PRINTLN "Pass"
ELSE
PRINTLN "Fail"
END IF
// Displays "Pass"NEW INT stock = 10
NEW INT reorderPoint = 10
IF stock >= reorderPoint
PRINTLN "Stock level adequate"
ELSE
PRINTLN "Time to reorder!"
END IF
// Displays "Stock level adequate"NEW INT remaining = 5
WHILE remaining >= 0
PRINTLN "Items remaining: " .. remaining
SET remaining = remaining - 1
END WHILE
PRINTLN "All items processed"NEW INT x = 10
NEW FLOAT y = 5.0
PRINTLN x >= y // Type error! Cannot mix Integer and FloatNEW STR name1 = "Bob"
NEW STR name2 = "Alice"
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 points = 100
// Wrong if you want to exclude 100
IF points >= 100
PRINTLN "100 points or more" // This includes 100
END IF
// Correct for exclusive check
IF points > 100
PRINTLN "More than 100 points" // This excludes 100
END IF
// Displays "100 points or more"