# Global functions · Chromia Docs (concept)

> Rell provides a collection of built-in global functions for common tasks. For complete API documentation, see the Standard Library reference.

Source: https://docs.chromia.com/rell/language-features/systemlib/global-functions/

# Global functions

On this page

* [Overview](#overview)
* [Key functions](#key-functions)
* [Using empty and exists in at-expressions](#using-empty-and-exists-in-at-expressions)

Rell provides a collection of built-in global functions for common tasks. For complete API documentation, see the
[Standard Library reference](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/).

## Overview

Global functions are available without any namespace prefix and cover:

* **Math operations** – `abs`, `min`, `max` for
  [`integer`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/integer/),
  [`big_integer`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/big_integer/), and
  [`decimal`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/decimal/) types
* **Collection checks** – `empty` and `exists` for nullable values, lists, sets, and maps
* **Output** – `print` and `log` for debugging
* **Cryptographic hashes** – `sha256`, `keccak256`
* **Signature verification** – `verify_signature`
* **Ethereum operations** –
  [`eth_ecrecover`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/eth_ecrecover/) for public
  key recovery
* **Error handling** – [`require`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/require/),
  [`rell.error`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/rell/error/), [`try_call`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/try_call/), and
  [`try_call_catch`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/try_call_catch/), documented under [`require` and error handling](https://docs.chromia.com/rell/language-features/systemlib/require-function/)

## Key functions

* [`abs`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/abs/) – Returns the absolute value of
  a number
* [`min`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/min/),
  [`max`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/max/) – Returns the smaller/larger of
  two values
* [`empty`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/empty/) – Checks if a value is null
  or an empty collection
* [`exists`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/exists/) – Checks if a value is
  non-null and non-empty
* [`print`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/print/),
  [`log`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/log/) – Output to stdout or log
* [`sha256`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/sha256/),
  [`keccak256`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/keccak256/) – Cryptographic hash
  functions
* [`verify_signature`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/verify_signature/) –
  Verifies a signature against a message and public key
* [`try_call`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/try_call/),
  [`try_call_catch`](https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/try_call_catch/) – Catch
  exceptions; see [`require` and error handling](https://docs.chromia.com/rell/language-features/systemlib/require-function/)

## Using `empty` and `exists` in at-expressions

Both `empty()` and `exists()` support nested at-expressions, enabling efficient SQL queries:

Rell

```
// Find users with no company in their city
user @* {
    empty(company @* { .city == user.city })
}

// Find users with at least one company in their city
user @* {
    exists(company @* { .city == user.city })
}
```

Use `@*` in nested at-expressions to execute as a single SQL query. Other cardinality operators (`@+`, `@?`, `@`) result
in separate queries.

[View this page on docs.chromia.com](https://docs.chromia.com/rell/language-features/systemlib/global-functions/)Content mirrored from the live docs
