Assigns

From Xojo Documentation

Language Keyword

Used to indicate that a value will be passed via a parameter to a method with the Assignment operator.

Usage

Assigns parameter As DataType

Part Type Description
parameter The name of the parameter being declared.
DataType Any valid data type The data type of the parameter.

Notes

Use the Assigns keyword when you want to assign a value to a parameter of a method with the equals sign rather than as an argument.

The Assigns keyword can appear in a Method declaration dialog box for the only parameter passed to the method or for the last parameter, if more than one parameter is being passed. When Assigns is used, you use a different syntax when calling the method. The value for the Assigns parameter must be passed using the assignment operator rather than as an argument.

Sample Code

The following declaration uses Assigns for the last parameter:

Sub ChangeValue(a As Integer, b As Integer, Assigns c As Integer)

When this method is called, only the values for a and b are passed as arguments; the value for c is passed using the assignment operator. For example:

ChangeValue(5, 4) = 10

This usage results in a syntax error when Assigns is used:

ChangeValue(5, 4, 10)

See Also

Assigns can only be used on the last parameter Error.