Skip to main content

Values

Rell offers various data types for managing information in your dapps. Here's an overview of the fundamental types you'll use.

Simple values

  • Null: Represents the absence of a value. It has its own distinct type, null.
  • Boolean: Represents logical values, either true or false. Employ them for conditional logic and decision-making.
  • Integer: Represents whole numbers, both positive and negative, like 123, 0, and -456. Use them for counting, indexing, and mathematical operations.
  • Text: Represents sequences of characters, enclosed in either single quotes ('Hello') or double quotes ("World"). Store and manipulate text data effectively.
  • Byte array: Represents a sequence of bytes, essential for handling binary data. Prefix them with x' for single quotes or x" for double quotes (e.g., x'1234', x"ABCD").
  • Big integer: Represents arbitrarily large whole numbers, denoted by a suffix of L (e.g., 9223372036854775832L). Handle massive numerical values with ease.
  • Decimal: Represents numbers with decimal places, like 123.456. Crucial for precise calculations and financial applications.

Text literals

  • Standard: \r (carriage return), \n (line feed), \t (tab), \b (backspace)
  • Special characters: \" (double quote), \' (single quote), \\ (backslash)
  • Unicode: \u003A (e.g., represents a colon)

Trailing commas

A trailing comma is allowed in any comma-separated list, including collections, function parameters, and enums.

val my_list = [
123,
456,
789,
];

val my_map = [
123: 'A',
456: 'B',
];

enum colors {
RED,
GREEN,
BLUE,
}

function f(
x: integer,
y: text,
) {
// function body
}

query q() = f(
123,
'A',
);