{{fbdoc item="title" value="OPTION BYVAL"}}---- Specifies parameters are to be passed by value by default in procedure declarations {{fbdoc item="syntax"}}## **Option Byval** ## {{fbdoc item="desc"}} ##**Option Byval**## is a statement that sets the default passing convention for procedure parameters to //by value//, as if declared with ##[[KeyPgByval|Byval]]##. This default remains in effect for the rest of the module in which ##**Option Byval**## is used, and can be overridden by specifying ##[[KeyPgByref|Byref]]## in parameter lists. {{fbdoc item="ex"}} {{fbdoc item="filename" value="examples/manual/switches/option-byval.bas"}}%%(freebasic) '' 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 %% {{fbdoc item="lang"}} - Only available in the //[[CompilerOptlang|-lang fblite]]// and //[[CompilerOptlang|-lang qb]]// dialects. {{fbdoc item="diff"}} - New to ""FreeBASIC"" {{fbdoc item="see"}} - ##[[KeyPgDdfboptionbyval|__FB_OPTION_BYVAL__]]## {{fbdoc item="back" value="CatPgCompilerSwitches|Compiler Switches"}}