4.5 Flow control

 

There are the commands to control the AMMP program flow.

 

 

EXIT
 

Quit AMMP, releasing all resources.

 

Parameters:
None.

 

Return message:
None.

 

Example:
EXIT;

 

See also:
None.


JE   (VAR)Var1   (VAR)Var2    (LABEL)Label
 

Jump if equal.

Parameters:
Var1    Variables to compare.
Var2  
Label   Label of a new program section.

Return message:
None.

 

Example:
JE    a   1   MyLabel:;
...
MyLabel:;
...

 

See also:
JES, JG, JL, JNE, JNES.


JES   (UINT)Atom   (CHAR)Name    (LABEL)Label
 

Check the atom name and if it's equal to the string, jump to the label.

Parameters:
Atom    Atom serial number.
Name   Atom name.
Label   Label of a new program section.

Return message:
None.

 

Example:
JES    3   "ca"   MyLabel:;
...
MyLabel:;
...

 

See also:
JE, JG, JL, JNE, JNES.


JG   (VAR)Var1   (VAR)Var2    (LABEL)Label
 

Jump if greater.

Parameters:
Var1    Variables to compare.
Var2  
Label   Label of a new program section.

Return message:
None.

 

Example:
JG    a   1   MyLabel:;
...
MyLabel:;
...

 

See also:
JE, JES, JL, JNE, JNES.


JL   (VAR)Var1   (VAR)Var2    (LABEL)Label
 

Jump if less.

Parameters:
Var1    Variables to compare.
Var2  
Label   Label of a new program section.

Return message:
None.

 

Example:
JL    a   1   MyLabel:;
...
MyLabel:;
...

 

See also:
JE, JES, JG, JNE, JNES.


JNE   (VAR)Var1   (VAR)Var2    (LABEL)Label
 

Jump if not equal.

Parameters:
Var1    Variables to compare.
Var2  
Label   Label of a new program section.

Return message:
None.

 

Example:
JNE    a   1   MyLabel:;
...
MyLabel:;
...

 

See also:
JE, JES, JG, JL, JNES.


JNES   (UINT)Atom   (CHAR)Name    (LABEL)Label
 

Check the atom name and if it's not equal to the string, jump to the label.

Parameters:
Atom    Atom serial number.
Name   Atom name.
Label   Label of a new program section.

Return message:
None.

 

Example:
JES    3   "ca"   MyLabel:;
...
MyLabel:;
...

 

See also:
JE, JES, JG, JL, JNE.


LOOPF   (LABEL)Label   (FLOAT)Init    (FLOAT)End   (FLOAT)Inc
 

Define a floating point loop.

Parameters:
Label    Label of the loop end
Init   Starting value. It could be a floating point variable.
End   Ending value.
Inc   Step increment (default 1.0).

Return message:
None.

 

Example:
SETF   i   1.0;


LOOPF    MyLabel:;   i   10.0;
...
MyLabel:;
...

 

See also:
LOOPI.


LOOPI   (LABEL)Label   (INT)Init    (INT)End   (INT)Inc
 

Define an integer loop.

Parameters:
Label    Label of the loop end
Init   Starting value. It could be a floating point variable.
End   Ending value.
Inc   Step increment (default 1).

Return message:
None.

 

Example:
SETI   i   0;
LOOPF    MyLabel:;   i   10   2;
...
MyLabel:;
...

 

See also:
LOOPF.