Parameter List

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

Syntax

Unenclosed form

required_param_list [ , Optional optional_param_list ]

Enclosed form

( [ required_param_list [ , Optional optional_param_list ] ] )

Parts

required_param
Syntax
[ ByRef ] typed_param_name
optional_param
Syntax
[ ByRef ] typed_param_name [ = default_value ]
typed_param_name
Syntax
param_name [ ( [ rank ] ) ] [ As param_type | In param_unit ]
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.
param_name
Necessary 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.
param_type
Optional
param_unit
Optional
default_value
Optional constant of a type compatible with param_type or param_unit.

Details

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