Multiple Statements in a Single Line in VB.NET

Placing Multiple Statements in a Single Line
  • 4986

Placing Multiple Statements in a Single Line

If you need to place multiple statements in a single line, you can separate statements with a colon. The code snippet in Listing 4 places three statements in a single line.

    Function MultipleStatementInSingleLine(ByVal NumberOne As Integer, _

                                     ByVal NumberTwo As IntegerAs Integer

        Dim total As Integer = NumberOne + NumberTwo : Dim difference = NumberOne - NumberTwo : Return total

 

    End Function 

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.