Multiple Choice Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > SCS. - Select from Mutiple Cases >

Multiple Choice Commands

CAE. - Case-Else

Previous Top Next


MiniRobotLanguage (MRL)

 

CAE. Command

Case Else

 

 

Intention

 

This command can be used together with:

    SCS.

    CAN.

    ESC.

    CAS.

to build  multiple-choice constructs.

 

CAE always evaluates to TRUE if none of the previous constructs has evaluated TRUE.

 

See example below.

 

: §§TXT=Karl Kovse

SCS.§§TXT

CAS.Karl

 PRT.This will come

CAS.Peter

 PRT.This will not come  

CAE.

 PRT. This will not come

ESC.

MBX.Ready  

ENR.

 

 

 

 

 

Syntax

 

 

 

CAE.

 

 

Parameter Explanation

 

This command does not need any parameters.

 

 

Speed in Ticks:

This command uses typically around 14 Ticks.

 

 

Example

 

'********************************************

' Demo for SCS., CAS., CAE., ESC. and CAN.

'********************************************

' SCS.-Test

'DBM.2

FOR.$$LOP|1|20

 VAR.$$TXT=Peter$$LOP

 VAR.$$NUM=500

 PRT.TXT=$$TXT

 SCS.$$TXT

 CAS.Was first case.

   PRT.First Case

' This one will come in the twentieth

 CAS.{Rufus&OR:Peter2}

   PRT.Was "Peter2..."

' You can jump out of the structure directly with GOTO.

' And you can nest unlimited many SCS.

   SCS.$$NUM

   CAN.(100*5)

     PRT.You can nest it unlimited.

   CAN. 499

' You can even intermix CAS. / CAN.

   CAS. Intermixed

   CAE.

     PRT.THis will not come

   ESC.

   JMP. otu

 CAS.Third

   PRT.Was Third

 CAS.{Peter&AND:3}

   PRT.Was "Peter" and "3"

' If you need a perfect match ...

 CAS.{&EXACT:Theo}

   PRT.This one is Theo.

 CAS.Fourth.

   PRT.Was this one.

' CASE ELSE

 CAE.

   PRT.Was nothing of all.

' END SELECT

 ESC.

 :otu

NEX.

MBX.Ending

:enz

END.

 

 

Speed in Ticks:

This command uses typically around 15 Ticks.

 

 

Remarks

 

Please do not write code between the SCS. and the first following CAS./CAN.

While this code will actually be executed, you could get memory-leaks if you jump out of the construct from that place.

 

 

 

Limitations:

 

There are no relevant nesting limitations.

 

Here is a general hint:

Please always make formulas into (...) to make sure they will be calculated.

 

 

 

See also:

 

  1.6.1. Program Flow Control

  1. SCS. - Select Case

  2. CAS. - Case-String

  3. CAN. - Case-Numeric

  4. CAE. - Case-Else

   5.CFP. - Case Find Pattern

   6.ESL. - End Select Loop

   7.ESC. - End Select Case