OPTION BYVAL
- Source: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgOptionbyval
- Last revised: 2016-02-10
Specifies parameters are to be passed by value by default in procedure declarations
Syntax
` Option Byval
`
Description
Option Byval is a statement that sets the default passing convention for procedure parameters to by value, as if declared with Byval. This default remains in effect for the rest of the module in which Option Byval is used, and can be overridden by specifying Byref in parameter lists.
Examples
start GeSHi
vb
'' compile with the "-lang fblite" compiler switch
#lang "fblite"
Sub TestDefaultByref( a As Integer )
'' change the value
a = a * 2
End Sub
Option ByVal
Sub TestDefaultByval( a As Integer )
a = a * 2
End Sub
Dim a As Integer = 1
Print "a = "; a
TestDefaultByref( a )
Print "After TestDefaultByref : a = "; a
Print
Print "a = "; a
TestDefaultByval( a )
Print "After TestDefaultByval : a = "; a
Printend GeSHi
Dialect Differences
- Only available in the -lang fblite and -lang qb dialects.
Differences from QB
- New to FreeBASIC
See also
__FB_OPTION_BYVAL__
Back to DocToc