Built-In Functions

This section contains a list of built-in functions in GateKeeper language.

[Note]Note

lhs & rhs are used to denote the left-hand-side and right-hand-side operands.

Built-In FunctionUsageAllowed Types

negate Operation

negate rhs

- rhs

integer, double, duration and money

not Operation

! rhs

not rhs

boolean

or Operation

lhs or rhs

lhs || rhs

Allowed types: boolean

and Operation

lhs and rhs

lhs && rhs

boolean

in Operation

lhs in (rhs1, rhs2, rhs3, ...

The in operator is shorthand for and exactly equivalent to the following:

lhs == rhs1 or lhs == rhs or lhs == lhs == rhs

lhs and rhs must be of the same type, except that integer and double types can be compared.

notIn Operation

lhs notIn ( rhs1, rhs2, rhs3 … )

The lhs and rhs values must be of the same type, except that integer and double types can be compared. The notIn operator is shorthand for and exactly equivalent to the following:

lhs != rhs1 and lhs != rhs2 and lhs!=rhs3

equals Operation

lhs equals rhs

lhs == rhs

The lhs and rhs values must be the same type or except that integer and double types can be compared.

All types

notEquals Operation

lhs notEquals rhs

lhs != rhs

The lhs and rhs values must be the same type or except that integer and double types can be compared.

All types

lessThan Operation

lhs lessThan rhs

lhs < rhs

The lhs and rhs values must be the same type or except that integer and double types can be compared.

greaterThan Operation

lhs greaterThan rhs

lhs > rhs

The lhs and rhs values must be the same type or except that integer and double types can be compared.

integer, double, money, datetime, duration

lessThanOrEquals Operation

lhs lessThanOrEquals rhs

lhs <= rhs

The lhs and rhs values must be the same type or except that integer and double types can be compared.

integer, double, money, datetime, duration

greaterThanOrEquals Operation

lhs greaterThanOrEquals rhs

lhs >= rhs

The lhs and rhs values must be the same type, or except that integer and double types can be compared.

integer, double, money, datetime, duration

add Operation

lhs plus rhs

lhs + rhs

Integer and double can be operated on, which will result in a double unless both operands are integers.

Operations on money require that both lhs and rhs be the money type.

A duration can be added to a duration, resulting in a duration.

A datetime can be added to a duration or a duration can be added to a datetime, resulting in a datetime.

integer, double, money, datetime, duration

sub Operation

lhs minus rhs

lhs - rhs

Integer and double can be operated on, which will result in a double unless both operands are integers.

Operations on money require that both lhs and rhs be the money type.

A duration can be subtracted from a duration, resulting in a duration.

A duration can be subtracted from a datetime, a datetime must be the lhs and a duration must be the rhs, resulting in a datetime.

multiply Operation

lhs times rhs

lhs * rhs

Integer and double can be operated on, which will result in a double unless both operands are integers.

For money, money can be multiplied by an integer or double, resulting in money.

For duration, a duration can be multiplied by an integer, resulting in a duration.

div Operation

lhs div rhs

lhs / rhs

Integer and double can be operated on, which will result in a double unless both operands are integers.

For money, money can be divided by an integer or double, the lhs must be a money value and the rhs must be an integer or double, resulting in money.

if Operation

if(conditional-exp, true-exp, false-exp)

conditional-exp ? true-exp : false-exp

conditional-exp must resolve to boolean true-exp and false-exp operands must be the same type

orSay Operation

lhs condition rhs orSay message

Example:

MyRole == 'Caller' orSay 'The role does not match';

min Operation

min(lhs, rhs)

All comparable types (all except boolean and string). All operands must be the same type

max Operation

max(lhs, rhs)

All comparable types (all except boolean and string). All operands must be the same type

max Operation

max(lhs, rhs)

All comparable types (all except boolean and string). All operands must be the same type

mod Operation

mod(lhs, rhs)

Integer

Results in the integer remainder of dividing lhs by rhs.

cat Operation

cat(lhs, rhs)

String

Results in the combined string of lhs and rhs.

getCurrencyCode

getCurrencyCode(rhs)

Returns the currency code as a string.