OWBasic for Pocketviewer

Home INTRO Group USERPROC Alphabetical Index

Arrays as procedure parameters

Arrays can be used as parameters for user procedures only as variable parameters. That means that procedures always operate with the original array and modifications become effective immediately.

In the procedure heading arrays must be defined as VAR parameters. An empty pair of opening and closing square brackets mark the parameter as array. Call the procedure with only the name of the array as parameter.

Example:
PROC set VAR f[],n
! sets Integer array f to the value n 
 FOR i=0 TO arraysize(f)
  f[i]=n
 NEXT
ENDP

DIM A[10]: ! Create array
set a,9:   ! set with the value 9 


Home INTRO Group USERPROC Alphabetical Index