This repository has been archived on 2025-08-04. You can view files and clone it, but cannot push or open issues or pull requests.
rhaj/_archive/rhai_engine/rhaibook/engine/builtin.md
2025-04-04 08:28:07 +02:00

2.9 KiB

Built-in Operators

{{#include ../links.md}}

The following operators are built-in, meaning that they are always available, even when using a [raw Engine].

All built-in operators are binary, and are supported for both operands of the same type.

Operators Assignment operators Supported types
(see [standard types])
+, +=
  • INT
  • FLOAT (if not [no_float])
  • [Decimal][rust_decimal] (requires [decimal])
  • char
  • [string]
-, *, /, %, **, -=, *=, /=, %=, **=
  • INT
  • FLOAT (if not [no_float])
  • [Decimal][rust_decimal] (requires [decimal])
<<, >> <<=, >>=
  • INT
&, |, ^ &=, |=, ^=
  • INT (bit-wise)
  • bool (non-short-circuiting)
&&, ||
  • bool (short-circuits)
==, !=
  • INT
  • FLOAT (if not [no_float])
  • [Decimal][rust_decimal] (requires [decimal])
  • bool
  • char
  • [string]
  • [BLOB]
  • numeric [range]
  • ()
>, >=, <, <=
  • INT
  • FLOAT (if not [no_float])
  • [Decimal][rust_decimal] (requires [decimal])
  • char
  • [string]
  • ()

`FLOAT` and [`Decimal`][rust_decimal] also inter-operate with `INT`, while [strings] inter-operate
with [characters][string] for certain operators (e.g. `+`).