Multiple Statements in a Single Line in VB.NET

Placing Multiple Statements in a Single Line
  • 5498

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

© 2020 DotNetHeaven. All rights reserved.