# Expressions

A TypeQL expression uses operators and functions to compute a value from other values. It uses the following syntax:

```typeql
let <var> = <expression>;
```

Examples:

```typeql
#!test[read]
match
let $x = 5;

let $y = $x * 3.1;

let $z = ceil($y + 1);
```

## [](#_validation)Validation

The following rules apply to variables involved in expressions:

*   The variables used on the right-hand side of an expression must be bound to either attributes or values.
    
*   The attribute may be of various attribute types as long as they all have the same value type.
    
*   A value variable must be assigned to exactly once.
    

During compilation, the types of every subexpression are resolved, and the expression tree is constructed. If any function which is passed an argument which does not match the expected type, or any operator which is not defined for the given combination of types, will fail compilation with an error.

## [](#_explore_expressions)Explore expressions

[Literals](literals/index.md)

Syntax for literal values in TypeQL.

[Value operations](value-operations/index.md)

Arithmetic and other operators in TypeQL expressions.

[Function calls](function-calls/index.md)

Calling functions in TypeQL expressions.

[Built-in functions](builtin-functions/index.md)

Built-in TypeQL functions.

[Duration](../values/duration/index.md) [Literals](literals/index.md)

[Edit on GitHub](https://github.com/typedb/typedb-docs/edit/3.x-development/typeql-reference/modules/ROOT/pages/expressions/index.adoc) Edit this page on GitHub.