<< Click to Display Table of Contents >> Navigation: ThinBASIC Core Language > Script structure > Execution directives > #DEFAULT > PARAMETERS |
Description
This execution directive changes the way undefined passing parameters are interpreted in case of no explicit parameter passing method (ByRef or ByVal).
Default method is BYVAL.
Syntax
#DEFAULT PARAMETERS [BYREF | BYVAL]
Returns
None
Parameters
Remarks
Restrictions
See also
Examples
'--------------------------------------------------------------------
'---EXAMPLE: 2
'---This example will pass MyVal using ByVal method, the standard one
'--------------------------------------------------------------------
Function MyFunction(MyParam As Long) As Long
MyParam = 12345
Function = MyParam
End Function
Dim MyVal As Long
MyVal = 1
MyFunction(MyVal)
'---MSGBOX will show "1"
MSGBOX 0, MyVal
'--------------------------------------------------------------------
'---EXAMPLE: 1
'---This example will pass MyVal using ByRef method
'--------------------------------------------------------------------
#DEFAULT PARAMETERS ByRef
Function MyFunction(MyParam As Long) As Long
MyParam = 12345
Function = MyParam
End Function
Dim MyVal As Long
MyVal = 1
MyFunction(MyVal)
'---MSGBOX will show "12345"
MSGBOX 0, MyVal