IF Statements

edit
Language General Usage Example Usage
Pseudocode
/ If...Then Statement

IF <Condition>
    THEN
        <Statements>
ENDIF

/ If...Then...Else Statement

IF <Condition>
    THEN
        <Statements>
    ELSE
        <Statements>
ENDIF

/ ElseIf Statement

IF <Condition>
    THEN
        <Statements>
ELSEIF <Condition>
    THEN
        <Statements>
    ELSE
        <Statements>
ENDIF
/ If...Then Statement

IF Age < 16
    THEN
        CanDrive ← FALSE
ENDIF

/ If...Then...Else Statement

IF IsGreen
    THEN
        OUTPUT "Green"
    ELSE
        OUTPUT "Blue"
ENDIF

/ ElseIf Statement

IF Score > 1000
    THEN
        Multiplier ← 10
ELSEIF Score < 500
    THEN
        Multiplier ← 0
    ELSE
        Multiplier ← 5
ENDIF
VB.NET
'If...Then Statement

If <Condition> Then
    <Statements>
End If

'If...Then...Else Statement

If <Condition> Then
    <Statements>
Else
    <Statements>
End If

'Else If Statement

If <Condition> Then
    <Statements>
Else If <Condition> Then
    <Statements>
Else
    <Statements>
End IF
'If...Then Statement

If Age < 16 Then
    CanDrive = False
End If

'If...Then...Else Statement

If IsGreen Then
    Console.WriteLine("Green")
Else
    Console.WriteLine("Blue")
End If

'Else If Statement

If Score > 1000 Then
    Multiplier = 10
Else If Score < 500 Then
    Multiplier = 0
Else
    Multiplier = 5
End If

Nested IF Statements

edit
Language General Usage Example Usage
Pseudocode
IF <Condition>
    THEN
        IF <Condition>
            THEN
                <Statements>
        ENDIF
ENDIF
IF Found = False
    THEN
        IF Searching = false
            THEN
                CALL Search()
        ENDIF
ENDIF

IF Age >= 16
    THEN
        IF PassedLicenceTest = True
            THEN
                CALL GenerateLicence()
                
        ELSEIF TakenTest = False
            THEN
                OUTPUT "You need to take the test to get your licence"
            ELSE
                OUTPUT "You Failed Your Test"
                OUTPUT "You need to pass the test to get your licence"
        ENDIF
    ELSE
        OUTPUT "Ineligible for Licence"
ENDIF
VB.NET
If <Condition> Then
    If <Condition> Then
        <Statements>
    End If
End If
If Found = False Then
    If Searching = false Then
        Search()
    End If
End If

If Age >= 16 Then
    If PassedLicenceTest = True Then
        GenerateLicence()
    Else If TakenTest = False Then
        Console.WriteLine("You need to take the test to get your licence")
    Else
        Console.WriteLine("You Failed Your Test")
        Console.WriteLine("You need to pass the test to get your licence")
    End If
Else
    Console.WriteLine("Ineligible for Licence")
End If

CASE Statements

edit
Language General Usage Example Usage
Pseudocode
CASE OF <identifier>
    <value 1> : <statement>
    <value 2> : <statement>
    ...
ENDCASE

CASE OF <identifier>
    <value 1> : <statement>
    <value 2> : <statement>
    ...
    OTHERWISE <statement>
ENDCASE
/ If...Then Statement

IF Age < 16
    THEN
        CanDrive ← FALSE
ENDIF

/ If...Then...Else Statement

IF IsGreen
    THEN
        OUTPUT "Green"
    ELSE
        OUTPUT "Blue"
ENDIF

/ ElseIf Statement

IF Score > 1000
    THEN
        Multiplier ← 10
ELSEIF Score < 500
    THEN
        Multiplier ← 0
    ELSE
        Multiplier ← 5
ENDIF
VB.NET
'If...Then Statement

If <Condition> Then
    <Statements>
End If

'If...Then...Else Statement

If <Condition> Then
    <Statements>
Else
    <Statements>
End If

'Else If Statement

If <Condition> Then
    <Statements>
Else If <Condition> Then
    <Statements>
Else
    <Statements>
End IF
'If...Then Statement

If Age < 16 Then
    CanDrive = False
End If

'If...Then...Else Statement

If IsGreen Then
    Console.WriteLine("Green")
Else
    Console.WriteLine("Blue")
End If

'Else If Statement

If Score > 1000 Then
    Multiplier = 10
Else If Score < 500 Then
    Multiplier = 0
Else
    Multiplier = 5
End If