Conditions
RCBasic uses If / ElseIf / Else / End If for conditional logic.
Basic Syntax
If condition Then
' code executed when condition is true
End If
With Else:
If x > 10 Then
Print "Big"
Else
Print "Small"
End If
Multiple branches with ElseIf:
If score >= 90 Then
Print "A"
ElseIf score >= 80 Then
Print "B"
ElseIf score >= 70 Then
Print "C"
Else
Print "F"
End If
Comparison Operators
Operator |
Meaning |
|---|---|
|
Equal to |
|
Less than |
|
Greater than |
|
Less than or equal to |
|
Greater than or equal to |
|
Not equal to |
Logical Operators
|
Both sides must be true |
|---|---|
|
At least one side must be true |
|
Exactly one side true, the other false |
|
Negates the expression |
If num = 3 OR num = 4 Then
Print "Good Answer"
ElseIf num > 5 AND num < 9 Then
Print "Choice numbers"
Else
Print "Maybe next time"
End If