FUNCTION name (parameter list)  [AS INTEGER | STRING | SINGLE]
  parameter list = parameter [, parameter list]
  parameter  =  [BYVAL] paramname [AS INTEGER]
                    |  [BYVAL] paramname AS SINGLE
                    |  [BYVAL] paramname(size) AS STRING 


Used as a modifier in parameter declarations for FUNCTIONs or SUBs.

When BYVAL is used a copy of the parameter will be used in the FUNCTION or SUB.  And the FUNCTION or SUB procedure can change the copy of the parameter, BUT not the original.  BYVAL is the default declaration and is assumed if the BYVAL or BYREF keyword are not used, except for arrays.


function toupper(a(100) as string) as string 
  dim i as integer 
  for i=0 to 100
    if a(i)=0 then exit 
    if a(i) <= "z" and a(i) >= "a" then a(i) = a(i) - &H20
  next i
  return a
end function


print toupper("asdf")                   '  will print ASDF

Differences from other BASICs

See also