Declare |
Previous Next |
DECLARE <RoutineType> ([<ParameterList>]) [AS <Type>]
|
Part
|
Description
|
<RoutineType>
|
Required. This tells the compiler what type of routine you've
created. Acceptable values are:
|
<ParameterList>
|
Optional. Parameter Lists are optional and their restrictions depend
on whether the routine is an ASM routine or not.
For non-ASM routines, you would declare your arguments just like
you would in the Dim and Global commands. See the example
below.
For ASM routines, see below in the notes section.
|
<Type>
|
Optional. The AS <Type> is used only on functions, not ASM
functions or either type of SUB. If the AS <Type> is omitted, the
compiler will look to see if the function name has an identifier and
will assign the <Type> automatically.
|
MySub 10, 10
Print MyFunc(12,12)
Print MyASMFunc(5,1)
' Example Sub
Declare Sub MySub(x As Integer, y As Integer)
Print x * y
End Sub
' Example Function
Declare Function MyFunc(x As Integer, y As Integer) As Integer
Return x * y
End Function
' Example ASM Function
Declare Asm Function MyASMFunc(d0.l, d1 As Byte)
add.l d1, d0
End Function
|