Procedure

Syntax:
Procedure <Procedure name>([[Val] <Param1> [=<DefVal>], ... ,[Val] <ParamN> [=<DefVal>]])[Export] 
// Declaration of local variables;
// Operators;
...
[Return;]
// Operators;
...
EndProcedure

 

Parameters:
<Procedure name>
The procedure name.

Val
An optional keyword. A parameter that follows the keyword is passed as a value (changing the value of the formal parameter during the procedure execution does not affect the actual parameter that is passed when the procedure is called). If this keyword is not specified, the procedure parameter is passed as a reference (changing the formal parameter value inside the procedure changes the actual parameter value).

<Param1>, ..., <ParamN>
An optional comma-separated list of formal parameters. Formal parameter values must correspond to the values of actual parameters that are passed to the procedure. This list defines the name of each parameter as it is used in the procedure text. The list of formal parameters can be empty.

=<DefVal>
An optional default parameter value. You can include parameters with default values anywhere in the list of formal parameters (for details, see Passing procedure and function parameters help topic).

Export
An optional keyword that specifies that this procedure is accessible from other program modules.

// Declaration of local variables
Declares local variables that can be referenced in this procedure only (see Var operator description).

// Operators
Executable procedure operators.

Return
An optional keyword that ends the procedure and returns to the point of the program that called the procedure.

EndProcedure
A mandatory keyword that identifies the end of procedure.
Returns to the point of the program that called the procedure.

Description:
The Procedure keyword denotes the beginning of a source code area that can be called from any point of the program module using the <Procedure name> operator with a list of parameters (round brackets are mandatory, even if no parameters are passed). If an ordinary application module, managed application module, or common program module contains the Export keyword in the body of a procedure definition, it means that this procedure is accessible from all other configuration modules.

When the Return operator is executed, the procedure ends and returns control to the point of call. If procedure text does not contain the Return operator, an implicit Return operator is executed after the last executable operator. The end of the procedure is denoted by the EndProcedure operator.

The variables declared in the local variable declaration area of the procedure body are local variables and therefore accessible in this procedure only (except when they are used as parameters for calling other procedures, functions, or methods).


    

1C:Enterprise Developer's Community