Show/Hide Toolbars

XSharp

Purpose

Call a procedure or function, and optionally pass arguments to the called routine.

Syntax

DO <idProcedure> [WITH <uValueArgList>]

Arguments

<idProcedure>The name of the procedure or function to execute.

 

WITH <uValueArgList>A comma-separated list of arguments to pass to <idProcedure>.

Description

DO performs the same action as a function or procedure specified on a line by itself with the exception that variables other than field variables are passed by reference as the default.  
In order to pass a field variable as an argument, enclose it in parentheses, unless you declare it with the FIELD statement or specify it with an alias.

Examples

This example executes a procedure with no parameters:

DO AcctsRpt
AcctsRpt()                        // Preferred method

The next example executes a procedure passing two constants:

DO QtrRpt WITH "2nd", "Sales Division"
// Preferred method
QtrRpt("2nd", "Sales Division")

In this example, a procedure is executed with the first argument passed by value and the second passed by reference:

nNumber := 12
DO YearRpt WITH nNumber + 12, nNumber
// Preferred method
YearRpt(nNumber + 12, @nNumber)

Here, a procedure is invoked with skipped arguments embedded in the list of arguments:

DO DisplayWindow WITH ,,,,"My Window"
// Preferred method
DisplayWindow(,,,,"My Window")

See Also

FIELD, FUNCTION, LOCAL, PARAMETERS, PRIVATE, PROCEDURE, PUBLIC, RETURN