Skip to content

OPTION BYVAL


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
Print

end GeSHi

Dialect Differences

Differences from QB

  • New to FreeBASIC

See also

  • __FB_OPTION_BYVAL__

Back to DocToc

Translated from FreeBASIC official docs. Contact us for removal if infringed.
FreeBASIC is an open-source project, not affiliated with Microsoft