Call Statement

From Logic Wiki
Revision as of 13:27, 9 May 2016 by Dt1nh6 (Talk | contribs) (1 revision imported)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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