Call Statement

From Logic Wiki
Jump to: navigation, search


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