SecondBASIC Documentation v3

Home / Command Reference / If...End If

If...End If

Description: Executes code based on if a set of criteria is met or not.


If <Expression> Then
    ' Code
[Else, Elseif <Expression>> Then]
    ' Code
End If

Part Description
<Expression> Required. The <Expression> must return true or false.


    a = 5
    b = a
    If a < 5 Then
        Print "a is less than 5"
    ElseIf a > 5 Then
        Print "a is greater than 5"
        Print "a is 5"
        If b = 5 Then Print "b is also 5"
    End If