[ Back ]

A procedure is a sub program that you can create anywhere in the code with:

procedure name([parameter 1>[, parameter 2 ...]])

All variables created inside a procedure are visible only in that procedure, and they're released when the procedure exits. Variables inside the procedure may have the same names as variables in other procedures or in the main program. The optional parameters, that can be passed to the procedure when calling it, act just like local variables. Ex:

procedure Dummy(an_integer, a_float#, a_string$)
  another_integer = an_integer
  another_float = a_float# + float#(a_string$)

You execute a procedure with:

proc name [parameter 1[, parameter 2 ...]]


proc Dummy 5, 3.14, "Ehr?"

Tip! The code looks more clear with proc, but the word can be replaced with a '_' character. That is:

_Dummy 5, 3.14, "Ehr?"

Procedures may be recursive (make calls to themselves).

[ Back ]