2. Basic operation manual

6. Maths operators

17 views 2019-06-04 2019-06-04 peterletintech 0

M5Flow provides many operators, which are symbols that specify which operations to perform in an expression. You can overload many operators to change their meaning when applied to a user-defined type.

Operations on integral types (such as ==!=<>) are generally allowed.

Multiplicative Operators

These operators have higher precedence than the next section and lower precedence than the previous section.

 – multiplication.

 – division. If the operands are integers, the result is an integer truncated toward zero.

Additive Operators

These operators have higher precedence than the next section and lower precedence than the previous section.

 – addition.

  – subtraction.

Relational and Type-testing Operators

These operators have higher precedence than the next section and lower precedence than the previous section.

 – less than (true if x is less than y).

 – greater than (true if x is greater than y).

 – less than or equal to.

 – greater than or equal to.

Equality Operators

These operators have higher precedence than the next section and lower precedence than the previous section.

 – equality.

 – not equal.

Other Operators

  – set true if x is even, odd, prime, whole, positive, negative and divisible by.

 – return a random fraction between 0 to 1.

 – return a random integer.

 – return the square of a number.

 – return a number with sin, cos, tan, asin, acos and atan.

 – convert string and float to integer.

 – convert string and integer to float.

Example “0 to 100” generator

For Using the loop function, the system generate a random number between 0 to 100 for every second.

Was this helpful?