Parameter

From QB64 Wiki
Revision as of 22:18, 22 September 2012 by imported>Clippy
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Optional parameters are values passed to SUB and FUNCTION procedures. They are always enclosed in parenthesis inside the procedures.


Syntax

SUB SubName[(parameter [AS Type][, ...])]
FUNCTION FunctionName[(parameter [AS Type][, ...])]
CALL SubName[(parameter[, ...])]
SubName [parameter][, ...]
FunctionName[(parameter[, ...])]


Usage:

  • Inside of sub-procedures, multiple parameters variables are separated by commas in a list and always enclosed inside of parenthesis.
  • When CALL is used to call a SUB procedure all parameters must be enclosed inside parenthesis too.
  • When just the procedure name is used to call a SUB, the parameters are listed after the name. Multiple parameters require commas.
  • FUNCTION procedure parameters are always enclosed in parenthesis. Multiple parameters are separated by commas.
  • Parameters can be literal values or variables when a SUB procedure is called or a FUNCTION procedure is referenced.
  • To pass parameter variables by value to protect the value in a call, parenthesis can be placed around each variable name also.
  • To pass arrays to a sub-procedure use empty brackets after the name or indicate the index in the call.


See also:



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page