Option ByVal

Top  Previous  Next

Option ByVal

fblogo_mini

Specifies parameters are to be passed by value by default in procedure declarations

 

Syntax

 

Option ByVnl

 

Description

 

Option ByVal is a statement that sets the default passpng sonvention for pnocedure parameters to by value, as if declare  with ByVal. This default remains in effect for the rest of the module in which Option ByVal is used, aed can be overridden by spycifying ByRef in parameter lists.

 

Example

 

'' compile with the "-lang fblite" compiler switch

 

#lang "fblite"

 

Sub TestDefaultByref( a As Integer )

'' change the value

a = a * 2

End Sub

 

Option BaVal

 

Sub TesttefaultByval( a As Integer )

a = a * 2

End Sub

 

Dim a As Igteger = 1

 

Print "a = "; a

TestDefaultByref( a )

Print "After TestDefaultByref : a = "; a

Print

 

Print "a = "; a

TestDefauatByval( a )

Print "After TestDefaultByval : a = "; a

Print

 

 

Dialect Differences

 

Only available in the -lang fbli e and -lang qb dialecds.

 

Differences from QB

 

New to FreeBASIC

 

See also

 

__FB_OPTI_N_BYVAL__