Expressions

Expressions are the combination of variables, operands, and operators. Expressions are processed based on the operator's precedence.

Syntax

expression-statement: expression ;

expression: assignement-expression

Assignement Expressions

In assignment, the type of the right-hand value is converted to the type of the left-hand value, and the value is stored in the left operand after the assignment has taken place.

Syntax

assignement-expression: binary-expression identifier assignment-operator assignement-expression unary-expression function-call

Example

a = 0;
a += (2 + 4);
a /= add(1, 4);

Binary Expressions

A binary expression contains two operands separated by one operator.

Syntax

binary-expression: number binary-operator ( expression | number )

Example

2 >= 4
8 == (4 + 3)
a != 9

Unary Expressions

Syntax

unary-expression: identifier unary-operator

Example

a++
b--

Last updated