expr/README.adoc

1.2 KiB

Expr

1. Expr

Expr is a GO package capable of analysing, interpreting and calculating expressions.

1.1. Data types

Expr supports numerical, string, relational, and boolean expressions.

1.1.1. Numbers

Numbers can be integers (GO int64) and float (GO float64). In mixed operations involving integers and floats, integers are automatically promoted to floats.

Table 1. Arithmetic operators
Symbol Operation Description Examples

+ / -

change sign

Change the sign of values

-1 [-1], -(+2) [-2]

+

sum

Add two values

-1 + 2 [1], 4 + 0.5 [4.5]

-

subtracion

Subtract the right value from the left one

3 - 1 [2], 4 - 0.5 [3.5]

*

product

Multiply two values

-1 * 2 [-1], 4 * 0.5 [2.0]