|
|
|
|
|
- Default typecasting of parameters
- Forcing the typecasting of parameters
Typecasting of parameters
Default typecasting of parameters The description of the parameter type is optional. By default, the type of the variable passed as parameter in the call to the procedure is used in the procedure. For example: Index is int // Call to MyProc procedure MyProc(Index)
// // -- Declaration of MyProc procedure PROCÉDURE MyProc(Counter) // Counter is an integer Counter += 1
Therefore, the same procedure can be used for several types of variables. Forcing the typecasting of parameters To force the typecasting of parameters, use the following syntax: PROCEDURE <Procedure name>(<Parameter 1> is <Type>, ... <Parameter 2> is <Type>, ..., <Parameter N> is <Type>) The type of the variable passed as parameter (in the call to the procedure) must be the same as the one described in the procedure declaration. Otherwise, an error occurs when compiling the project, window or report. In the following example, the "Index" variable is not a string: an error will occur when compiling the project, window or report. Index is int = 7 // Call to MyProc procedure MyProc(Index)
// -- Declaration of MyProc procedure PROCEDURE MyProc(Index is string) ...
Remarks: - For arrays, see Array parameter and Associative Array parameters.
- For Data Source variables, the data source can be associated with a file when typecasting the parameter via the <description> extension attribute. For more details, see Data Source variable.
- A light syntax can be used to typecast the parameters: the term "is a" can be deleted:
PROCEDURE <Procedure name>(<Parameter 1> <Type>, ..., <Parameter N> <Type>) For example: PROCEDURE MyProc(Index string)
- A parameter can correspond to any type of variable. A class instance can be passed as parameter to a procedure.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|