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

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

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.

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

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)

{ 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.

__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