ProtoLang.net

Reference: Elif

☰ Hide Sidebar
TOKEN ELIF
ALIAS None

The Elif token (short for "else if") is used within If statements to check additional conditions when the previous If or Elif condition evaluates to False. Elif allows you to test multiple conditions in sequence, executing the code block of the first condition that evaluates to True. Once a True condition is found, all subsequent Elif and Else clauses are skipped.

Syntax

The short syntax structure uses the word ELIF:

IF CONDITION
    STATEMENTS
ELIF CONDITION
    STATEMENTS
END IF

The long syntax structure uses the word ELIF:

IF CONDITION
    STATEMENTS
ELIF CONDITION
    STATEMENTS
END IF

Basic Elif Usage

Elif provides an alternative condition to check when the If condition is False.

Example: Simple If-Elif

NEW INT score = 75
IF score >= 90
    PRINTLN "Grade: A"
ELIF score >= 80
    PRINTLN "Grade: B"
END IF
// Displays "Grade: B"

Example: If-Elif with Different Data Type

NEW STR status = "pending"
IF status == "complete"
    PRINTLN "Task finished"
ELIF status == "pending"
    PRINTLN "Task in progress"
END IF
// Displays "Task in progress"

Example: If-Elif with Boolean

NEW BOOL isAdmin = FALSE
NEW BOOL isModerator = TRUE
IF isAdmin == TRUE
    PRINTLN "Admin access"
ELIF isModerator == TRUE
    PRINTLN "Moderator access"
END IF
// Displays "Moderator access"

Example: If-Elif with Float Comparison

NEW FLOAT temperature = 85.5
IF temperature >= 100.0
    PRINTLN "Very hot"
ELIF temperature >= 80.0
    PRINTLN "Hot"
END IF
// Displays "Hot"

Multiple Elif Clauses

You can use multiple Elif clauses to check several conditions in sequence. Only the first True condition executes.

Example: Multiple Elif for Grading

NEW INT score = 72
IF score >= 90
    PRINTLN "Grade: A"
ELIF score >= 80
    PRINTLN "Grade: B"
ELIF score >= 70
    PRINTLN "Grade: C"
ELIF score >= 60
    PRINTLN "Grade: D"
END IF
// Displays "Grade: C"

Example: Day of Week

NEW INT day = 4
IF day == 1
    PRINTLN "Monday"
ELIF day == 2
    PRINTLN "Tuesday"
ELIF day == 3
    PRINTLN "Wednesday"
ELIF day == 4
    PRINTLN "Thursday"
ELIF day == 5
    PRINTLN "Friday"
ELIF day == 6
    PRINTLN "Saturday"
ELIF day == 7
    PRINTLN "Sunday"
END IF
// Displays "Thursday"

Example: Temperature Classification

NEW FLOAT temp = 62.0
IF temp >= 90.0
    PRINTLN "Very hot"
ELIF temp >= 75.0
    PRINTLN "Warm"
ELIF temp >= 60.0
    PRINTLN "Mild"
ELIF temp >= 40.0
    PRINTLN "Cool"
ELIF temp >= 20.0
    PRINTLN "Cold"
END IF
// Displays "Mild"

Example: Menu Selection

NEW INT choice = 3
IF choice == 1
    PRINTLN "New Game"
ELIF choice == 2
    PRINTLN "Load Game"
ELIF choice == 3
    PRINTLN "Settings"
ELIF choice == 4
    PRINTLN "Quit"
END IF
// Displays "Settings"

Elif with Else Clause

An Else clause can be added after Elif clauses to handle cases where none of the conditions are True.

Example: If-Elif-Else

NEW INT score = 55
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: F"

Example: Status Check with Default

NEW STR status = "archived"
IF status == "active"
    PRINTLN "Currently active"
ELIF status == "pending"
    PRINTLN "Awaiting approval"
ELIF status == "complete"
    PRINTLN "Finished"
ELSE
    PRINTLN "Unknown or archived status"
END IF
// Displays "Unknown or archived status"

Example: Age Category with Else

NEW INT age = 150
IF age < 13
    PRINTLN "Child"
ELIF age < 20
    PRINTLN "Teenager"
ELIF age < 60
    PRINTLN "Adult"
ELIF age < 120
    PRINTLN "Senior"
ELSE
    PRINTLN "Invalid age"
END IF
// Displays "Invalid age"

Execution Order

Elif clauses are checked in order from top to bottom. Once a condition evaluates to True, its code block executes and all remaining Elif and Else clauses are skipped.

Example: First Match Wins

NEW INT value = 15
IF value > 10
    PRINTLN "Greater than 10"
ELIF value > 5
    PRINTLN "Greater than 5"
ELIF value > 0
    PRINTLN "Greater than 0"
END IF
// Displays "Greater than 10" only

Example: Order Matters

NEW INT number = 100
IF number >= 50
    PRINTLN "At least 50"
ELIF number >= 75
    PRINTLN "At least 75"
ELIF number >= 100
    PRINTLN "At least 100"
END IF
// Displays "At least 50" ( first condition matches )

Example: Correct Ordering

NEW INT number = 100
IF number >= 100
    PRINTLN "At least 100"
ELIF number >= 75
    PRINTLN "At least 75"
ELIF number >= 50
    PRINTLN "At least 50"
END IF
// Displays "At least 100" ( most specific first )

Elif with Comparison Operators

Elif conditions can use any Comparison Operator.

Example: Using All Comparison Types

NEW INT x = 50
IF x == 100
    PRINTLN "Exactly 100"
ELIF x > 75
    PRINTLN "Greater than 75"
ELIF x >= 50
    PRINTLN "50 or more"
ELIF x < 25
    PRINTLN "Less than 25"
ELIF x != 0
    PRINTLN "Not zero"
END IF
// Displays "50 or more"

Example: String Equality Checks

NEW STR color = "green"
IF color == "red"
    PRINTLN "Stop"
ELIF color == "yellow"
    PRINTLN "Caution"
ELIF color == "green"
    PRINTLN "Go"
END IF
// Displays "Go"

Example: Inequality Checks

NEW STR password = "guest123"
IF password == "admin123"
    PRINTLN "Admin login"
ELIF password == "user123"
    PRINTLN "User login"
ELIF password != ""
    PRINTLN "Invalid credentials"
END IF
// Displays "Invalid credentials"

Elif with Logical Operators

Elif conditions can combine multiple checks using And and Or operators.

Example: Elif with And Operator

NEW INT age = 25
NEW BOOL hasLicense = TRUE
NEW BOOL hasInsurance = FALSE
IF ( age >= 18 ) && hasLicense && hasInsurance
    PRINTLN "Can rent premium car"
ELIF ( age >= 18 ) && hasLicense
    PRINTLN "Can rent standard car"
ELIF age >= 18
    PRINTLN "Need license to rent"
ELSE
    PRINTLN "Must be 18 or older"
END IF
// Displays "Can rent standard car"

Example: Elif with Or Operator

NEW STR role = "moderator"
NEW BOOL isOwner = FALSE
IF role == "admin"
    PRINTLN "Full access"
ELIF ( role == "moderator" ) || isOwner
    PRINTLN "Elevated access"
ELIF role == "user"
    PRINTLN "Standard access"
ELSE
    PRINTLN "Guest access"
END IF
// Displays "Elevated access"

Example: Complex Logical Conditions

NEW INT score = 75
NEW INT attendance = 85
NEW BOOL extraCredit = FALSE
IF ( score >= 90 ) && ( attendance >= 80 )
    PRINTLN "Grade: A"
ELIF ( score >= 80 ) && ( attendance >= 75 )
    PRINTLN "Grade: B"
ELIF ( score >= 70 ) && ( ( attendance >= 70 ) || extraCredit )
    PRINTLN "Grade: C"
ELIF score >= 60
    PRINTLN "Grade: D"
ELSE
    PRINTLN "Grade: F"
END IF
// Displays "Grade: C"

Example: Multiple Or Conditions

NEW STR day = "Saturday"
IF day == "Monday"
    PRINTLN "Start of work week"
ELIF ( day == "Saturday" ) || ( day == "Sunday" )
    PRINTLN "Weekend"
ELIF day == "Friday"
    PRINTLN "Last work day"
ELSE
    PRINTLN "Midweek"
END IF
// Displays "Weekend"

Modifying Variables in Elif Blocks

Variables can be created or modified within Elif blocks using New and Set commands.

Example: Setting Variable in Elif

NEW FLOAT temperature = 85.0
NEW STR status = ""
IF temperature >= 100.0
    SET status = "Critical"
ELIF temperature >= 80.0
    SET status = "Warning"
ELIF temperature >= 60.0
    SET status = "Normal"
ELSE
    SET status = "Cold"
END IF
PRINTLN "Temperature status: " .. status
// Displays "Temperature status: Warning"

Example: Calculating Discount

NEW FLOAT purchaseAmount = 150.0
NEW FLOAT discountRate = 0.0
IF purchaseAmount >= 500.0
    SET discountRate = 0.25
ELIF purchaseAmount >= 200.0
    SET discountRate = 0.15
ELIF purchaseAmount >= 100.0
    SET discountRate = 0.10
ELIF purchaseAmount >= 50.0
    SET discountRate = 0.05
END IF
NEW FLOAT finalAmount = purchaseAmount - ( purchaseAmount * discountRate )
PRINTLN "Discount: " .. ( discountRate * 100.0 ) .. "%"
PRINTLN "Final amount: " .. finalAmount
// Displays "Discount: 10.0%" and "Final amount: 135.0"

Example: Multiple Variable Updates

NEW INT score = 78
NEW STR grade = ""
NEW INT points = 0
IF score >= 90
    SET grade = "A"
    SET points = 100
ELIF score >= 80
    SET grade = "B"
    SET points = 85
ELIF score >= 70
    SET grade = "C"
    SET points = 75
ELIF score >= 60
    SET grade = "D"
    SET points = 65
ELSE
    SET grade = "F"
    SET points = 0
END IF
PRINTLN "Grade: " .. grade
PRINTLN "Points: " .. points
// Displays "Grade: C" and "Points: 75"

Example: Accumulating Values

NEW STR category = "silver"
NEW INT basePoints = 100
NEW INT bonusPoints = 0
IF category == "platinum"
    SET bonusPoints = 50
ELIF category == "gold"
    SET bonusPoints = 30
ELIF category == "silver"
    SET bonusPoints = 15
ELIF category == "bronze"
    SET bonusPoints = 5
END IF
NEW INT totalPoints = basePoints + bonusPoints
PRINTLN "Total points: " .. totalPoints
// Displays "Total points: 115"

Elif with Expressions

Elif conditions can evaluate complex Expressions using arithmetic and comparison operators.

Example: Arithmetic in Elif Condition

NEW INT x = 12
NEW INT y = 8
IF ( x + y ) > 25
    PRINTLN "Sum is large"
ELIF ( x + y ) > 15
    PRINTLN "Sum is medium"
ELIF ( x + y ) > 10
    PRINTLN "Sum is small"
END IF
// Displays "Sum is medium"

Example: Modulo in Elif

NEW INT number = 15
IF ( number % 5 ) == 0
    IF ( number % 3 ) == 0
        PRINTLN "Divisible by both 3 and 5"
    ELSE
        PRINTLN "Divisible by 5 only"
    END IF
ELIF ( number % 3 ) == 0
    PRINTLN "Divisible by 3 only"
ELSE
    PRINTLN "Not divisible by 3 or 5"
END IF
// Displays "Divisible by both 3 and 5"

Example: Division in Condition

NEW INT total = 80
NEW INT count = 4
NEW INT average = total / count
IF average >= 90
    PRINTLN "Excellent average"
ELIF average >= 80
    PRINTLN "Good average"
ELIF average >= 70
    PRINTLN "Fair average"
ELSE
    PRINTLN "Poor average"
END IF
// Displays "Fair average"

Example: Multiple Expression Comparisons

NEW FLOAT price = 100.0
NEW FLOAT taxRate = 0.08
NEW FLOAT total = price + ( price * taxRate )
IF total > 150.0
    PRINTLN "Expensive purchase"
ELIF total > 100.0
    PRINTLN "Moderate purchase"
ELIF total > 50.0
    PRINTLN "Small purchase"
ELSE
    PRINTLN "Minimal purchase"
END IF
// Displays "Moderate purchase"

Nested Elif Statements

Elif blocks can contain nested If-Elif-Else statements for complex decision trees.

Example: Nested If-Elif

NEW STR userType = "premium"
NEW INT accountAge = 15
IF userType == "premium"
    IF accountAge >= 12
        PRINTLN "Premium member - 1 year+ rewards"
    ELIF accountAge >= 6
        PRINTLN "Premium member - 6 month rewards"
    ELSE
        PRINTLN "Premium member - new"
    END IF
ELIF userType == "standard"
    PRINTLN "Standard member"
ELSE
    PRINTLN "Guest"
END IF
// Displays "Premium member - 1 year+ rewards"

Example: Multi-Level Decision Tree

NEW INT age = 22
NEW BOOL studentStatus = TRUE
NEW FLOAT income = 25000.0
IF age < 18
    PRINTLN "Minor - no eligibility"
ELIF age < 25
    IF studentStatus == TRUE
        PRINTLN "Student discount eligible"
    ELIF income < 30000.0
        PRINTLN "Low income discount eligible"
    ELSE
        PRINTLN "Standard rate"
    END IF
ELIF age < 65
    PRINTLN "Standard adult rate"
ELSE
    PRINTLN "Senior discount eligible"
END IF
// Displays "Student discount eligible"

Example: Nested Priority Checks

NEW INT priority = 2
NEW BOOL urgent = FALSE
IF priority == 1
    PRINTLN "Critical priority"
ELIF priority == 2
    IF urgent == TRUE
        PRINTLN "High priority - urgent"
    ELSE
        PRINTLN "High priority - normal"
    END IF
ELIF priority == 3
    PRINTLN "Medium priority"
ELSE
    PRINTLN "Low priority"
END IF
// Displays "High priority - normal"

Practical Applications

Example: Shipping Cost Calculator

NEW FLOAT weight = 8.5
NEW FLOAT shippingCost = 0.0
IF weight <= 1.0
    SET shippingCost = 5.0
ELIF weight <= 5.0
    SET shippingCost = 10.0
ELIF weight <= 10.0
    SET shippingCost = 20.0
ELIF weight <= 20.0
    SET shippingCost = 35.0
ELSE
    SET shippingCost = 50.0
END IF
PRINTLN "Shipping cost: $" .. shippingCost
// Displays "Shipping cost: $20.0"

Example: Tax Bracket Calculator

NEW FLOAT income = 75000.0
NEW FLOAT taxRate = 0.0
IF income <= 10000.0
    SET taxRate = 0.10
ELIF income <= 40000.0
    SET taxRate = 0.12
ELIF income <= 85000.0
    SET taxRate = 0.22
ELIF income <= 160000.0
    SET taxRate = 0.24
ELSE
    SET taxRate = 0.32
END IF
NEW FLOAT taxAmount = income * taxRate
PRINTLN "Tax rate: " .. ( taxRate * 100.0 ) .. "%"
PRINTLN "Tax amount: $" .. taxAmount
// Displays "Tax rate: 22.0%" and "Tax amount: $16500.0"

Example: BMI Category

NEW FLOAT bmi = 24.5
NEW STR category = ""
IF bmi < 18.5
    SET category = "Underweight"
ELIF bmi < 25.0
    SET category = "Normal weight"
ELIF bmi < 30.0
    SET category = "Overweight"
ELIF bmi < 35.0
    SET category = "Obese Class I"
ELIF bmi < 40.0
    SET category = "Obese Class II"
ELSE
    SET category = "Obese Class III"
END IF
PRINTLN "BMI Category: " .. category
// Displays "BMI Category: Normal weight"

Example: Ticket Pricing System

NEW INT age = 67
NEW FLOAT ticketPrice = 0.0
IF age < 3
    SET ticketPrice = 0.0
ELIF age < 13
    SET ticketPrice = 10.0
ELIF age < 18
    SET ticketPrice = 15.0
ELIF age < 65
    SET ticketPrice = 25.0
ELSE
    SET ticketPrice = 18.0
END IF
PRINTLN "Ticket price: $" .. ticketPrice
// Displays "Ticket price: $18.0"

Example: Parking Fee Calculator

NEW INT hours = 5
NEW FLOAT fee = 0.0
IF hours <= 1
    SET fee = 3.0
ELIF hours <= 3
    SET fee = 8.0
ELIF hours <= 6
    SET fee = 15.0
ELIF hours <= 12
    SET fee = 25.0
ELSE
    SET fee = 40.0
END IF
PRINTLN "Parking fee: $" .. fee
// Displays "Parking fee: $15.0"

Example: Letter Grade with Plus/Minus

NEW INT percentage = 87
NEW STR letterGrade = ""
IF percentage >= 97
    SET letterGrade = "A+"
ELIF percentage >= 93
    SET letterGrade = "A"
ELIF percentage >= 90
    SET letterGrade = "A-"
ELIF percentage >= 87
    SET letterGrade = "B+"
ELIF percentage >= 83
    SET letterGrade = "B"
ELIF percentage >= 80
    SET letterGrade = "B-"
ELIF percentage >= 77
    SET letterGrade = "C+"
ELIF percentage >= 73
    SET letterGrade = "C"
ELIF percentage >= 70
    SET letterGrade = "C-"
ELIF percentage >= 67
    SET letterGrade = "D+"
ELIF percentage >= 63
    SET letterGrade = "D"
ELIF percentage >= 60
    SET letterGrade = "D-"
ELSE
    SET letterGrade = "F"
END IF
PRINTLN "Letter grade: " .. letterGrade
// Displays "Letter grade: B+"

Example: Weather Advisory System

NEW INT windSpeed = 45
NEW STR advisory = ""
IF windSpeed >= 74
    SET advisory = "Hurricane Warning"
ELIF windSpeed >= 64
    SET advisory = "Hurricane Watch"
ELIF windSpeed >= 58
    SET advisory = "Tropical Storm Warning"
ELIF windSpeed >= 39
    SET advisory = "Tropical Storm Watch"
ELIF windSpeed >= 25
    SET advisory = "High Wind Advisory"
ELSE
    SET advisory = "Normal Conditions"
END IF
PRINTLN "Weather Advisory: " .. advisory
// Displays "Weather Advisory: Tropical Storm Watch"

Example: Commission Calculator

NEW FLOAT sales = 75000.0
NEW FLOAT commissionRate = 0.0
IF sales >= 100000.0
    SET commissionRate = 0.15
ELIF sales >= 75000.0
    SET commissionRate = 0.12
ELIF sales >= 50000.0
    SET commissionRate = 0.10
ELIF sales >= 25000.0
    SET commissionRate = 0.08
ELSE
    SET commissionRate = 0.05
END IF
NEW FLOAT commission = sales * commissionRate
PRINTLN "Commission rate: " .. ( commissionRate * 100.0 ) .. "%"
PRINTLN "Commission earned: $" .. commission
// Displays "Commission rate: 12.0%" and "Commission earned: $9000.0"

Elif in Loops

Example: Elif Inside While Loop

NEW INT i = 1
WHILE i <= 10
    IF i <= 3
        PRINTLN i .. " is low"
    ELIF i <= 7
        PRINTLN i .. " is medium"
    ELSE
        PRINTLN i .. " is high"
    END IF
    SET i = i + 1
END WHILE

Example: Classification in Loop

NEW INT num = 1
WHILE num <= 20
    IF ( num % 15 ) == 0
        PRINTLN num .. " - FizzBuzz"
    ELIF ( num % 3 ) == 0
        PRINTLN num .. " - Fizz"
    ELIF ( num % 5 ) == 0
        PRINTLN num .. " - Buzz"
    ELSE
        PRINTLN num
    END IF
    SET num = num + 1
END WHILE

Example: Range Detection in Loop

NEW INT value = 10
WHILE value <= 100
    IF value < 25
        PRINTLN value .. " - Tier 1"
    ELIF value < 50
        PRINTLN value .. " - Tier 2"
    ELIF value < 75
        PRINTLN value .. " - Tier 3"
    ELSE
        PRINTLN value .. " - Tier 4"
    END IF
    SET value = value + 20
END WHILE

Elif with All Data Types

Example: Boolean in Elif

NEW BOOL isActive = FALSE
NEW BOOL isPending = TRUE
IF isActive == TRUE
    PRINTLN "Status: Active"
ELIF isPending == TRUE
    PRINTLN "Status: Pending"
ELSE
    PRINTLN "Status: Inactive"
END IF
// Displays "Status: Pending"

Example: Integer Range Checks

NEW INT quantity = 25
IF quantity >= 100
    PRINTLN "Bulk order"
ELIF quantity >= 50
    PRINTLN "Large order"
ELIF quantity >= 10
    PRINTLN "Standard order"
ELIF quantity >= 1
    PRINTLN "Small order"
ELSE
    PRINTLN "Invalid quantity"
END IF
// Displays "Standard order"

Example: Float Precision Checks

NEW FLOAT value = 3.14159
IF value == 3.14159
    PRINTLN "Exact match"
ELIF value > 3.14
    PRINTLN "Greater than 3.14"
ELIF value > 3.0
    PRINTLN "Greater than 3.0"
ELSE
    PRINTLN "Less than or equal to 3.0"
END IF
// Displays "Exact match"

Example: String Pattern Matching

NEW STR fileExt = "jpg"
IF fileExt == "txt"
    PRINTLN "Text file"
ELIF fileExt == "pdf"
    PRINTLN "PDF document"
ELIF fileExt == "jpg"
    PRINTLN "JPEG image"
ELIF fileExt == "png"
    PRINTLN "PNG image"
ELSE
    PRINTLN "Unknown file type"
END IF
// Displays "JPEG image"

Important Notes

  • Elif can only appear between If and Else ( or before END IF if no Else exists ).
  • You can have multiple Elif clauses in a single If statement.
  • Elif conditions are checked in order from top to bottom.
  • Once a condition evaluates to True, its block executes and all subsequent Elif/Else clauses are skipped.
  • Elif conditions must evaluate to a Boolean value ( True or False ).
  • Each Elif condition is only checked if all previous If/Elif conditions were False.
  • Order matters: place more specific conditions before more general ones.
  • Elif does not require an Else clause to follow it.
  • Variables modified in Elif blocks affect the global scope ( unless inside a function ).
  • String comparisons in Elif are case-sensitive.

Common Errors

Error: Elif Without If

NEW INT x = 5
ELIF x > 3 // Syntax error! ELIF must follow IF
    PRINTLN "Greater than 3"
END IF
// Correct:
IF x > 10
    PRINTLN "Greater than 10"
ELIF x > 3
    PRINTLN "Greater than 3"
END IF

Error: Elif After Else

NEW INT score = 75
IF score >= 90
    PRINTLN "A"
ELSE
    PRINTLN "Not an A"
ELIF score >= 80 // Syntax error! ELIF cannot come after ELSE
    PRINTLN "B"
END IF
// Correct:
IF score >= 90
    PRINTLN "A"
ELIF score >= 80
    PRINTLN "B"
ELSE
    PRINTLN "Not A or B"
END IF

Error: Missing Condition in Elif

NEW INT x = 5
IF x > 10
    PRINTLN "High"
ELIF // Syntax error! ELIF requires a condition
    PRINTLN "Low"
END IF
// Correct:
IF x > 10
    PRINTLN "High"
ELIF x > 5
    PRINTLN "Medium"
ELSE
    PRINTLN "Low"
END IF

Error: Using Assignment Instead of Comparison

NEW INT x = 5
IF x > 10
    PRINTLN "Greater than 10"
ELIF x = 5 // Syntax error! Use == for comparison, not =
    PRINTLN "Equal to 5"
END IF
// Correct:
IF x > 10
    PRINTLN "Greater than 10"
ELIF x == 5
    PRINTLN "Equal to 5"
END IF

Error: Non-Boolean Condition

NEW INT x = 5
IF x > 10
    PRINTLN "High"
ELIF x // Runtime error! Condition must be Boolean
    PRINTLN "Something"
END IF
// Correct:
IF x > 10
    PRINTLN "High"
ELIF x > 0
    PRINTLN "Positive"
END IF

Error: Comparing Different Data Types

NEW INT age = 25
NEW STR limit = "25"
IF age > 30
    PRINTLN "Over 30"
ELIF age == limit // Type error! Cannot compare Integer and String
    PRINTLN "At limit"
END IF
// Correct:
NEW INT ageLimit = 25
IF age > 30
    PRINTLN "Over 30"
ELIF age == ageLimit
    PRINTLN "At limit"
END IF

Error: Mixing Integer and Float

NEW INT score = 85
NEW FLOAT threshold = 80.0
IF score >= 90
    PRINTLN "A"
ELIF score >= threshold // Type error! Cannot compare Integer and Float
    PRINTLN "B"
END IF
// Correct:
NEW INT thresholdInt = 80
IF score >= 90
    PRINTLN "A"
ELIF score >= thresholdInt
    PRINTLN "B"
END IF

Error: Wrong Order of Conditions

NEW INT value = 95
IF value >= 50 // This catches all values >= 50
    PRINTLN "At least 50"
ELIF value >= 75 // This will never execute
    PRINTLN "At least 75"
ELIF value >= 90 // This will never execute
    PRINTLN "At least 90"
END IF
// Displays "At least 50" but misses more specific cases
// Correct: Order from most specific to most general
IF value >= 90
    PRINTLN "At least 90"
ELIF value >= 75
    PRINTLN "At least 75"
ELIF value >= 50
    PRINTLN "At least 50"
END IF
// Displays "At least 90"

Error: Case Sensitivity in Strings

NEW STR input = "YES"
IF input == "yes"
    PRINTLN "Confirmed lowercase"
ELIF input == "yes" // Still won't match due to case
    PRINTLN "This won't execute"
END IF
// Nothing is displayed
// Correct: Match the exact case
IF input == "yes"
    PRINTLN "Confirmed lowercase"
ELIF input == "YES"
    PRINTLN "Confirmed uppercase"
END IF
// Displays "Confirmed uppercase"

Error: Missing END IF

NEW INT x = 5
IF x > 10
    PRINTLN "Greater than 10"
ELIF x > 5
    PRINTLN "Greater than 5"
// Syntax error! Missing END IF
// Correct:
IF x > 10
    PRINTLN "Greater than 10"
ELIF x > 5
    PRINTLN "Greater than 5"
END IF