If ElseIf Else End If Demo : If « Language Basics « VB.Net






If ElseIf Else End If Demo

If ElseIf Else End If Demo
Imports System

Public Class MainClass
    Shared Sub Main()
        'Declare and set a variable
        Dim intNumber As Integer = 27

        If intNumber = 1000 Then
            System.Console.WriteLine("'intNumber' is, indeed, 1000!")
        ElseIf intNumber = 27 Then
            System.Console.WriteLine("'intNumber' is 27!")
        Else
            System.Console.WriteLine("'intNumber' is not 1000!")
        End If

    End Sub
End Class

           
       








Related examples in the same category

1.If then else ifIf then else if
2.Nested IfNested If
3.Use function in if statementUse function in if statement
4.If with Else
5.Simple If ThenSimple If Then
6.If Then Else DemoIf Then Else Demo