Parameter List

Specifies the parameters that a procedure expects when it is called. Multiple parameters must be separated by commas.

Syntax

Unenclosed form
requiredParamList [ , Optional optionalParamList ]
Enclosed form
( [ requiredParamList [ , Optional optionalParamList ] ] )

Parts

requiredParam
Syntax
[ ByRef ] typedParamName
optionalParam
Syntax
[ ByRef ] typedParamName [ = defaultValue ]
typedParamName
Syntax
paramName [ ( [ rank ] ) ] [ As paramType | In paramUnit ]
ByRef
Optional modifier (short for "by reference") allows the passed argument to have its value changed by the procedure, thus the parameter becomes an alias of the argument. Without this, the parameter is a copy of the argument. However, arrays are always passed by reference.
paramName
Required plain, string, or object identifier that is a local variable to the procedure.
rank
Optional integer literal enclosed in curly braces. Specifies the number of dimensions of the passed array.
paramType
Optional
paramUnit
Optional
defaultValue
Optional constant of a type compatible with paramType or paramUnit.

Remarks

Examples

The following examples use Method procedures, but they could just as well be Sub or Function procedures. The End Method clauses are also omitted to allow the parameter syntax to stand out.

No parameters

Method DoSomething
Method DoAnotherThing
Method GetInt%
Method GetInteger As Integer
Method GetStr$()
Method GetString() As String

One or more required parameters

Method DoSomethingWith number
Method ChangeStr ByRef str$
Method GetSomethingFrom<T>(#con As MyContainer<T>) As T

One or more optional parameters

Method 

See also