Variable Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Variable Definitions and Operations >

Variable Commands

IVV. / NVV. - If Variable Value        

Previous Top Next


MiniRobotLanguage (MRL)

 

IVV. Conditional Statement

If Variable Value

 

 

Intention

 

Test a condition and execute a block of program statements only if the condition is met.

 

There are two forms of IVV. available. First the quick-decision form, which is always like this:

 

IVV.(variable)(sign)(Number or variable)

 

It looks like this:

 

IVV.$$MAA=1

    ' Do something if result is NOT zero

ELS.

    ' Do this if result is zero.

EIF.

And secondly there is the mathematical IVV. It is formed like this:

 

IVV.(Any Formula like in CAL.)

 

The brackets (...) are needed so IVV. knows that you want the mathematical IVV.

The result is tested against zero to decide whether the condition is true (if it is non-zero) or not true ( when it is zero).

 

You can formulas with all operators from CAL., if you include them into ( ...).

In that case the condition is true, when the result is NOT zero.

 

' This will make an OR'ed decision

IVV.($$MAA<9)+($$MAB>0)

' Do something if result is NOT zero

ELS.

' Do this if result is zero.

EIF.

 

You can also use a Syntax with delimiters "|". In this case you can use formulas on both sides as you wish.

'

IVV.($$MAA*5)|>|(8*1+0.5+$$XYZ)

 

 

 

NVV. is the negative version of IVV.

 

Important:

Use IVV. only for numeric comparisons! For string comparisons use IVS. or IVC.

 

 

 

 

Syntax

 

 

 

IVV.P1|P2|P3

IVV.P1P2P3

 …

ELS.

  …

EIF.

 

 

Speed in Ticks:

This command uses typically around 60 to 120 Ticks, depending on the Parameters.

 

 

Parameter Explanation

 

P1 - Variable

P2- Condition

 ! (not equal),

 = (equal),

 > (bigger then),

 < (smaller then)

P3 - Any

 

When using Syntax 2, Codnition (P2) can be given as a Variable.

 

IVV's can be nested to unlimited Depth, and they can also enclose Sub-Program Calls or FEX. (Enumerations) to unlimited Depth.

 

 

Speed in Ticks:

This command uses typically around 70 to 150 Ticks heavily depending on the given Parameters.

 

 

Example

 

: AAB=2

IVV.$$AAB!3

IVV.$$AAA>1

 JNF.MySub.txt|$$AAA|2

ELS.

 JNF.YourSub.txt

EVV.

ELS.

: AAC=Hallo

: $$AAD=Nur

 IVV.$$AAC>$$AAD

 JNF.MySub.txt|$$AAA|2

ELS.

 JNF.YourSub.txt

EVV.

EVV.

 

 

 

Remarks

 

Use IVV. only for numeric comparisons! For string comparisons use IVS. or IVC.

 

 

 

Limitations:

 

-

 

 

 

 

See also:

 

    JIV. - Jump-If-Variable

    IVS. / NVS. - If-Variable-String

    IVC. / NVC. - If-Variable-Contains

    ELS. - ELSE

    EIF. - END IF

    CAL. - mathematical CALculation

    1.5. Features and Hints