Official website

Wednesday, February 20, 2013

Evaluation

Evaluation of an expression within Instruction Set allows you to add logic and extend the functionality.

Function

  evalBool: Returns one of two states, depending on the evaluation of an expression.

Parameters

  Expression
     Required. Boolean. The expression you want to evaluate.
  True Part
     Required. Type: Instruction Set. Called when expression evaluates to True.
  False Part
     Required. Type: Instruction Set. Called when expression evaluates to False.

Syntax

  { evalBool(expression); <true part>; <false part>; }

Relational & Conditional Operators

 equal to: ==
                i.e. (x == y)
                i.e. ("x" == "y")
                * String comparison require quotes
 not equal to: !=
                i.e. (x != y)
                i.e. ("x" != "y")
                * String comparison require quotes
 greater than: >
                i.e. (x > y)
 less than: <
                i.e. (x < y)
 greater than or equal to: >=
                i.e. (x >= y)
 less than or equal to: <=
                i.e. (x <= y)

 conditional AND: &&

                i.e. (x > 10 && x < 20)
 conditional OR: ||
                i.e. (x == 10 || x == 20)

 contains (Supported on ver. 0.2.1 of libJanet. To check your version, go to terminal tab and type %about%)

                i.e. (this is a test ~> is a)
                i.e. (%todayconditions% ~> Sunny)

Example

  { evalBool(*getTemp > 30);  foo1; foo2; }

The above example can be translate like...

If temperature is greater than 30 degrees then turn on a fan (foo1) else turn it off (foo2)

foo1, foo2 represents Instruction Set names. You can have more than one or none at any part.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.