Skip to content

Bio Expression Operations

Rajab Davudov edited this page Mar 13, 2019 · 1 revision

Logical Operators (and or < > <= >= = !=)

For logical operations you can use and or or tokens. As in following examples:

car.year_of_production > 2015 or car.fuel_efficiency < 12.4

car.is_sport_car and (car.producer = "BMW" or car.max_speed >= 200)

car.engine.engine_type != "vee" or car.producer = "BMW"

Arithmetic Operators (+ - * / % ^)

For arithmetic operations you can use standard symbols. As in following examples:

car.base_price * 1.12

car.base_price * distributer.interest - government.vat

1 + 2 * ( 45 / 5) / 3 - 28

2 ^ 32 - 2 ^ 30

Note that * and + can also be used by strings. As in following examples:

(car.name + " ") * 5

"Mr." + driver.name + " " + driver.lastname

Between Operator (x < y < z)

You can also use between syntax for checking in range. As in following example:

4 < car.engine.cylinders <= 6 and car.fuel_efficiency < 15.4

Negation Operator (!)

You can negate boolean results by ! symbol. As in following example:

!(car.is_sport_car or car.max_speed > 200)

!car.is_sport_car

Exists Operator (?)

Exists operator is used to check whether Bio Object has a tag value or not. As in following example:

?car.engine and !?car.engine.cylinders

car.engine.is_started and !?driver

Tag Operator (.)

Tag operator is used to indicate tag of a Bio Object or a function call be instead of tag name. As in following examples:

car.engine.cylinders > 4

car.engine.calculateHp()

Index Operator ([ ])

Index operators can be used to indicate index of array or list. As in following example:

car.seats[2].position

plane.engines[3].is_started