ex.hlp (Topic list)
DECLARE Statement (Basic Procedures) Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' This example uses the DECLARE statement to allow a SUB procedure to be
' invoked using the CALL keyword and the BYVAL keyword to pass an argument
' by value rather than by reference.
 
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the code example below to the code window
' 3. Press F5 to run the example
 
 DECLARE SUB Mult (BYVAL X!, Y!)
 CLS                         ' Clear the screen
 a = 1
 b = 1
 PRINT "Before subprogram call, A = "; a; ", B ="; b
 CALL Mult(a, b)             ' A is passed by value, and
                             ' B is passed by reference
 PRINT "After subprogram call, A ="; a; ", B ="; b
 
 SUB Mult (BYVAL X, Y)
     X = 2 * X
     Y = 3 * Y
     PRINT "In subprogram, X ="; X; " , Y ="; Y
 END SUB