Statements

In VB.NET, statements represent executable code. The next section outlines the statements found and VB.NET and their usage.

Blocks

A block statement allows multiple statements to be written in contexts where a single statement is allowed. A block statement consists of a statement list enclosed by braces:

Sub Main

End Sub

Statement Lists

A statement list is simply one or more statements written in sequence and enclosed in blocks as outlined following:

Sub Main
    Refresh()
    Repaint()
End Sub

Labeled

A labeled statement allows a statement to be referenced by a Goto statement. The scope of the label is the block that encloses it, including any nested blocks:

Sub Main
    If (X>0) Then Goto MyLabel
    X = X + 1
    MyLabel:
        return X
End Sub

Declarations ...

Get ASP.NET by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.