Let's say you want a procedure that uses 1 parameter. How inside the procedure do you reference the passed value?
A simple example I am trying:
@Define variable
Global mytext
@Set variable
Put 'hello' into mytext
@Call my procedure with 1 parameter
Call MyMessage(mytext)
There are some limitations with received parameter within a user defined procedure. For instance inside the called procedure that parameter cannot be passed onto a another procedure but its value can be used by another variable and so passed on. There is some explanation of this inside HAC's inbuilt help
Guide - in the section
Program Structure subsection
Procedures and Handlers.
if you pass a variable to your own procedure as a parameter then use a Local variable eg:-
.
Calling Handler or Procedure.
.
Local mytext
Put 'hello' into mytext
Call MyMessage(mytext)
or
Call MyMessage('Hello')
and inside MyMessage(mytextparam)Put mytextparam into field 1
Local myvar
Put mytextparam into myvar
Call MyProcedure2(myvar)
Of course you could use Global variables and just declare them in both places so not passing a variable in the call but its very hard to keep track of such globals.
In MyMessage what code will run the command Message with the passed parameter value?
I am familiar with other environments that use local $1, $2, etc for the passed parameters, or something similiar...
This is more messy because some commands can use the passed parameter directly,
such as the Message command
but others like user defined procedures cannot as explained above.
inside Procedure MyMessage(mytextparam) Message(mytextparam)