next up previous contents index
Next: Command files Up: Programming with the interpreter Previous: How to add new   Contents   Index


Conditions

It is possible to execute contitionally some instructions, interactively or in command files or programs, using the commands si... and is.... Inside programs it is better to use conditional jumps (cf. 4.8.2). For instance suppose you type

 - interpcom -> si ccc

where ccc is a variable name. In this case the interpreter will evaluate ccc. If the result is 0 or negative, the commands that follow will be ignored, until the interpreter receives the command

 - interpcom -> is ccc

and then the commands will be again accepted. It is also possible to avoid the following instructions if ccc is positive, by using

 - interpcom -> si non ccc


Example :

- interpcom -> c=1
                 1.000000
- interpcom -> d=-1
                -1.000000
- interpcom -> a=24
                 24.000000
- interpcom -> si c
- interpcom -> a
                 24.000000
- interpcom -> si d
- interpcom -> a
- interpcom -> is d
- interpcom -> a
                 24.000000
- interpcom -> si non d
- interpcom -> a
                 24.000000
- interpcom -> is d
- interpcom -> is c


The maximal number of current conditions (not closed with is...) is fixed in the initialization file (cf. 3.1).



2009-11-12