Skip to main content

Constant values

ALFA's policy expressions support constant values. The language parser directly recognizes and interprets four basic data types: strings, integers, doubles, and booleans which are represented as follows:

  • Strings are enclosed in either single or double quotes, allowing you to embed text and other characters.

    For instance, the expressions "hello" and 'A sunny day' represent strings containing the literal values "hello" and "A sunny day".

  • Integers consist of a numerical value without decimal points, optionally preceded by a minus sign (-).

    For example, the expressions 18, 20, and -34 are integers representing the numbers 18, 20, and -34, respectively.

  • Doubles, also known as floating-point numbers, represent numerical values with decimal points, and are optionally preceded by a minus sign (-).

    Expressions like 30.5, -95.899, and 109.2 represent doubles corresponding to the decimal values 30.5, -95.899, and 109.2, respectively.

  • Boolean values represent true or false conditions.

    The expressions true and false directly represent these values, without any quotes.

Other datatypes are represented using a string followed by a colon and the name of the datatype, as defined in the data type declaration. For instance, the expressions "127.0.0.1":ipAddress and '10.0.0.1':ipAddress represent IP addresses.