ex.hlp (Topic list)
UBOUND and LBOUND Functions Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' This example uses the LBOUND and UBOUND functions in a SUB procedure
' to determine the size of an array passed to the procedure by a calling
' program.
 
' 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 PRNTMAT (a!())
 
 CLS                                  ' Clear the screen
 DIM a(0 TO 3, 0 TO 3)
 FOR I% = 0 TO 3
         FOR J% = 0 TO 3
         a(I%, J%) = I% + J%
         NEXT J%
 NEXT I%
 CALL PRNTMAT(a())
 END
 
 STATIC SUB PRNTMAT (a())
         FOR I% = LBOUND(a, 1) TO UBOUND(a, 1)
         FOR J% = LBOUND(a, 2) TO UBOUND(a, 2)
                  PRINT a(I%, J%); " ";
         NEXT J%
         PRINT : PRINT
         NEXT I%
 END SUB