Standard Library Operator Functions

function

and_bool

and_bool returns the binary AND of the left- and right-hand-side arguments.

Inputs

  • Name
    lhs
    Description

    A boolean value.

  • Name
    rhs
    Description

    A boolean value.

Output

  • Name
    value
    Description

    The result of a binary AND between the two arguments.

Example using and_bool

output "my_bool" { 
  value = false && true
}
// > my_bool: false


function

or_bool

or_bool returns the binary OR of the left- and right-hand-side arguments.

Inputs

  • Name
    lhs
    Description

    A boolean value.

  • Name
    rhs
    Description

    A boolean value.

Output

  • Name
    value
    Description

    The result of a binary OR between the two arguments.

Example using or_bool

output "my_bool" { 
  value = false || true
}
// > my_bool: true


function

div

div returns the integer division of the left-hand-side argument by the right-hand-side argument, rounding any remainder down to the nearest integer.

Inputs

  • Name
    lhs
    Description

    The int dividend.

  • Name
    rhs
    Description

    The int divisor.

Output

  • Name
    value
    Description

    The result of dividing the dividend by the divisor.

Example using div

output "my_int" { 
  value = 11 / -3
}
// > my_int: -3


function

eq

eq returns true if the left- and right-hand-side arguments are equal and false if they are not.

Inputs

  • Name
    lhs
    Description

    An integer, float, string, boolean or null value.

  • Name
    rhs
    Description

    An integer, float, string, boolean or null value.

Output

  • Name
    value
    Description

    The result of an equality check between the two inputs.

Example using eq

output "is_eq" { 
  value = "arg" == "arg"
}
// > is_eq: true


function

gt

gt returns true if the left-hand-side argument is greater than the right-hand-side argument and false if it is not.

Inputs

  • Name
    lhs
    Description

    An integer, float, string, boolean or null value.

  • Name
    rhs
    Description

    An integer, float, string, boolean or null value.

Output

  • Name
    value
    Description

    The result of checking if the left-hand-side argument is greater than the right-hand-side argument

Example using gt

output "is_gt" { 
  value = 2 > 1
}
// > is_gt: true


function

gte

gte returns true if the left-hand-side argument is greater than or equal to the right-hand-side argument and false if it is not.

Inputs

  • Name
    lhs
    Description

    An integer, float, string, boolean or null value.

  • Name
    rhs
    Description

    An integer, float, string, boolean or null value.

Output

  • Name
    value
    Description

    The result of checking if the left-hand-side argument is greater than or equal to the right-hand-side argument

Example using gte

output "is_gte" { 
  value = 2 >= 2
}
// > is_gte: true


function

lt

lt returns true if the left-hand-side argument is less than the right-hand-side argument and false if it is not.

Inputs

  • Name
    lhs
    Description

    An integer, float, string, boolean or null value.

  • Name
    rhs
    Description

    An integer, float, string, boolean or null value.

Output

  • Name
    value
    Description

    The result of checking if the left-hand-side argument is less than the right-hand-side argument

Example using lt

output "is_lt" { 
  value = 2 < 1
}
// > is_lt: false


function

lte

lte returns true if the left-hand-side argument is less than or equal to the right-hand-side argument and false if it is not.

Inputs

  • Name
    lhs
    Description

    An integer, float, string, boolean or null value.

  • Name
    rhs
    Description

    An integer, float, string, boolean or null value.

Output

  • Name
    value
    Description

    The result of checking if the left-hand-side argument is less than or equal to the right-hand-side argument

Example using lte

output "is_lte" { 
  value = 2 <= 2
}
// > is_lte: true


function

neq

enq returns true if the left- and right-hand-side arguments are not equal and false otherwise.

Inputs

  • Name
    lhs
    Description

    An integer, float, string, boolean or null value.

  • Name
    rhs
    Description

    An integer, float, string, boolean or null value.

Output

  • Name
    value
    Description

    The result of a negated equality check between the two inputs.

Example using neq

output "is_neq" { 
  value = "arg" != "arg"
}
// > is_neq: false


function

minus

minus returns the result of subtracting the right-hand-side integer argument from the left-hand-side integer argument.

Inputs

  • Name
    lhs
    Description

    The integer minuend.

  • Name
    rhs
    Description

    The integer subtrahend.

Output

  • Name
    value
    Description

    The result of the subtraction operation.

Example using minus

output "my_integer" { 
  value = 10 - 6
}
// > my_integer: 4


function

modulo

modulo returns the remainder of dividing the left-hand-side integer argument by the right-hand-side integer argument.

Inputs

  • Name
    lhs
    Description

    The integer dividend.

  • Name
    rhs
    Description

    The integer divisor.

Output

  • Name
    value
    Description

    The remainder of the division operation.

Example using modulo

output "my_mod" { 
    value = 10 % 3
}
// > my_mod: 1


function

multiply

multiply returns the product of the left-hand-side integer argument and the right-hand-side integer argument.

Inputs

  • Name
    lhs
    Description

    The first integer operand.

  • Name
    rhs
    Description

    The second integer operand.

Output

  • Name
    value
    Description

    The result of the multiplication operation.

Example using multiply

output "my_product" { 
    value = 10 * 5
}
// > my_product: 50


function

add

add returns the sum of the left-hand-side integer argument and the right-hand-side integer argument.

Inputs

  • Name
    lhs
    Description

    The first integer operand.

  • Name
    rhs
    Description

    The second integer operand.

Output

  • Name
    value
    Description

    The result of the addition operation.

Example using add

output "my_sum" { 
    value = 10 + 5
}
// > my_sum: 15


function

neg_integer

Returns the negation of the given integer.

Inputs

  • Name
    value
    Description

    An integer value.

Output

  • Name
    value
    Description

    The negated integer value.

Example using neg_integer

// Coming soon

function

not_bool

Returns the logical negation of the given boolean value.

Inputs

  • Name
    value
    Description

    A boolean value.

Output

  • Name
    value
    Description

    The logical negation of the input boolean value.

Example using not_bool

// Coming soon

Was this page helpful?