Amos Professional Manual  Contents  Index

the Bare Bones


AMOS Professional provides over 200 ready-made functions, but it allows you to create as many different functions as you like! These "user-defined" functions are set up inside your own programs, and they can be used to compute commonly used values very quickly and very simply.

DEF FN
structure: create a user-defined function
Def Fn name (list of variables)=expression

To create a user-defined function, give it a name and follow the name with a list of variables. These variables must be held inside a pair of round brackets, and separated from one another by commas, like these examples:

X> Def Fn NAME$(A$)=LOWER$(A$)
   Def Fn X(A,B,C)=A*B*C

When a user-defined function is called up my variables that are entered with it will be substituted in the appropriate positions, as demonstrated below.

FN
structure: call a user-defined function
Fn name(list of variables)

The following examples show how DEF FN is first used to define a function, and how FN calls it up:

E> Def Fn NAME$(A$,X,Y)=Mid$(A$,X,Y)
   Print Fn NAME$("Professional",4,3)
  
E> Def Fn X(A,B,C)=A+B+C
   Print Fn X(1,10,100)

The expression that equals the user-defined function can include any of the standard AMOS Professional functions, and it is limited to a single line of a program.

Parameters
The values that are entered into an AMOS Professional instruction are known as "parameters". If there is more than one parameter, each parameter must be separated from its neighbour by a comma.

For example, up to three parameters can be used after an INK command, in the form of various numbers which specify which colour is to be used for drawing operations, then the background colour, and the third parameter setting a border colour. So an INK command could appear like this, with its three parameters ready to draw a shape:

E> Ink 0,1,2
   Bar 10,10 To 100,50
Back    Next
05.01.06