Example of a Procedure with a Var Parameter

The following example shows how the Max subroutine procedure accepts three parameters and returns a value. The subroutine returns the maximum number for any given two numbers.

The Max Subroutine Procedure

The Max procedure uses the following variables:

The Max procedure compares dA to dB to determine which variable has the greater value, stores the result (dx) as a Var parameter type, and then returns the higher value.

Calling a Var Parameter Procedure

To call the result (dx) stored as a Var parameter type in this procedure, you can use the following example code:

 

Max(1,10,d)

 

print d

!This will print 10.