Difference between revisions of "Call Statement"

From Logic Wiki
Jump to: navigation, search
(Created page with "Category:VB.NET You typically use the Call keyword when the called expression doesn’t start with an identifier. Use of the Call keyword for other uses isn’t recommend...")
 
m (1 revision imported)
 
(No difference)

Latest revision as of 14:27, 9 May 2016


You typically use the Call keyword when the called expression doesn’t start with an identifier. Use of the Call keyword for other uses isn’t recommended.

If the procedure returns a value, the Call statement discards it.

Example

The following code shows two examples where the Call keyword is necessary to call a procedure. In both examples, the called expression doesn't start with an identifier.

Sub TestCall()
    Call (Sub() Console.Write("Hello"))()

    Call New TheClass().ShowText()
End Sub 

Class TheClass
    Public Sub ShowText()
        Console.Write(" World")
    End Sub 
End Class