Amos Professional Manual  Contents  Index

Procedures


PARAM
function: return a parameter from a procedure
Param
Param#
Param$

The PARAM function takes the result of an expression in an END PROC statement, and returns it to the PARAM variable. If the variable you are interested in is a string variable, the $ character is used. Also note how the pairs of square brackets are used in the next two examples:

E> JOIN_STRINGS["one","two","three"]
   Print Param$
   Procedure JOIN_STRINGS[A$,B$,C$]
    Print A$,B$,C$
   End Proc[A$+B$+C$]

For real number variables, the # character must be used as in the following example:

E> JOIN_NUMBERS[1.5,2.25]
   Print Param#
   Procedure JOIN_NUMBERS[A#,B#]
    Print A#,B#
   End Proc[A#+B#]

Local data statements
Any data statements defined inside your procedures are held completely separately from those in the main program. This means that each procedure can have its own individual areas of data. Let us end this Chapter with a modest example that calls the same procedure using different parameters, and then sets up additional data in variables.

E> Curs Off : Paper 0
   RECORD["Francois","Lionet",29,"Genius"]
   RECORD["Mel","Croucher",44,"Unemployed"]
   A$="Richard" : B$="Vanner" : AGE=25 : OCC$="Slave Driver"
   RECORD[A$,B$,AGE,OCC$]
   Procedure RECORD[NAME$,SURNAME$,AGE,OCC$]
    Cls 0: Locate 0,3
    A$=NAME$+" "+SURNAME$
    Centre A$: Locate 0,6
    A$="Age: "+Str$(AGE)
    Centre A$: Locate 0,9
    A$="Occupation: "+OCC$
    Centre A$: Locate 0,16
    Centre "Press a key" : Wait Key
   End Proc
Back    Next
05.05.08