Mega Code Archive

 
Categories / VB.Net Tutorial / Statements
 

Single line vs Multi-line If statement

public class Test    public Shared Sub Main         Dim intScore As Integer         intScore = 23         'Single line If statement.         If intScore < 50 Then Console.WriteLine("Failed.") : Console.WriteLine("Please try again.")         'Multi-line If statement.         If intScore < 50 Then             Console.WriteLine("Failed.")             Console.WriteLine("Please try again.")         End If    End Sub End class Failed. Please try again. Failed. Please try again.