BYREF Statement |
![]() ![]() |
BYREF varname AS type
Declares a parameter as by reference (BYREF). Parameter can be to a sub program (RUN/SPAWN/CALL), a subroutine or function (SUB/FUNCTION) or an external library function (DECLARE)
Examples:
' Forward or external declarations DECLARE FUNCTION Pelle ALIAS "mm@pelle" DECLARE FUNCTION MessageBox LIB "kernel32.dll" ALIAS "MessageBoxA"( BYVAL hWnd AS INTEGER, BYREF lpText AS STRING, BYREF lpCapt AS STRING, BYVAL uType AS INTEGER ) AS INTEGER
' Parameters to Sub Program BYREF hult AS STRING BYVAL anka AS INTEGER
' Using Arrays as Parameters. Arrays must be as BYREF SUB PrintArray( BYREF arr AS INTEGER ) DIM i AS INTEGER
FOR i = 1 TO 10 PRINT "Array(";i;")=";arr(i), ENDFOR END SUB
DIM SomeArray(10) AS INTEGER CALL PrintArray( SomeArray )
END
|