IacStdFunctions

Operator Functions

Standard library operator functions for mathematical and logical operations

and_bool

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

Inputs

NameTypeDescription
lhsboolA boolean value
rhsboolA boolean value

Output

NameTypeDescription
valueboolThe result of a binary AND between the two arguments
output "my_bool" {
  value = false && true
}
// > my_bool: false

or_bool

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

Inputs

NameTypeDescription
lhsboolA boolean value
rhsboolA boolean value

Output

NameTypeDescription
valueboolThe result of a binary OR between the two arguments
output "my_bool" {
  value = false || true
}
// > my_bool: true

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

NameTypeDescription
lhsintegerThe dividend
rhsintegerThe divisor

Output

NameTypeDescription
valueintegerThe result of dividing the dividend by the divisor
output "my_int" {
  value = 11 / -3
}
// > my_int: -3

eq

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

Inputs

NameTypeDescription
lhsanyAny value
rhsanyAny value

Output

NameTypeDescription
valueboolThe result of an equality check between the two inputs
output "is_eq" {
  value = "arg" == "arg"
}
// > is_eq: true

gt

gt returns true if the left-hand-side argument is greater than the right-hand-side argument.

Inputs

NameTypeDescription
lhsinteger | float | stringA comparable value
rhsinteger | float | stringA comparable value

Output

NameTypeDescription
valueboolThe result of checking if the left-hand-side argument is greater than the right-hand-side argument
output "is_gt" {
  value = 2 > 1
}
// > is_gt: true

gte

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

Inputs

NameTypeDescription
lhsinteger | float | stringA comparable value
rhsinteger | float | stringA comparable value

Output

NameTypeDescription
valueboolThe result of checking if the left-hand-side argument is greater than or equal to the right-hand-side argument
output "is_gte" {
  value = 2 >= 2
}
// > is_gte: true

lt

lt returns true if the left-hand-side argument is less than the right-hand-side argument.

Inputs

NameTypeDescription
lhsinteger | float | stringA comparable value
rhsinteger | float | stringA comparable value

Output

NameTypeDescription
valueboolThe result of checking if the left-hand-side argument is less than the right-hand-side argument
output "is_lt" {
  value = 2 < 1
}
// > is_lt: false

lte

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

Inputs

NameTypeDescription
lhsinteger | float | stringA comparable value
rhsinteger | float | stringA comparable value

Output

NameTypeDescription
valueboolThe result of checking if the left-hand-side argument is less than or equal to the right-hand-side argument
output "is_lte" {
  value = 2 <= 2
}
// > is_lte: true

neq

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

Inputs

NameTypeDescription
lhsanyA value to compare
rhsanyA value to compare against

Output

NameTypeDescription
valueboolThe result of a negated equality check between the two inputs
output "is_neq" {
  value = "arg" != "arg"
}
// > is_neq: false

minus

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

Inputs

NameTypeDescription
lhsintegerThe minuend
rhsintegerThe subtrahend

Output

NameTypeDescription
valueintegerThe result of the subtraction operation
output "my_integer" {
  value = 10 - 6
}
// > my_integer: 4

modulo

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

Inputs

NameTypeDescription
lhsintegerThe dividend
rhsintegerThe divisor

Output

NameTypeDescription
valueintegerThe remainder of the division operation
output "my_mod" {
    value = 10 % 3
}
// > my_mod: 1

multiply

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

Inputs

NameTypeDescription
lhsintegerThe first operand
rhsintegerThe second operand

Output

NameTypeDescription
valueintegerThe result of the multiplication operation
output "my_product" {
    value = 10 * 5
}
// > my_product: 50

add

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

Inputs

NameTypeDescription
lhsintegerThe first operand
rhsintegerThe second operand

Output

NameTypeDescription
valueintegerThe result of the addition operation
output "my_sum" {
    value = 10 + 5
}
// > my_sum: 15

neg_integer

Returns the negation of the given integer.

Inputs

NameTypeDescription
valueintegerAn integer value

Output

NameTypeDescription
valueintegerThe negated integer value

not_bool

Returns the logical negation of the given boolean value.

Inputs

NameTypeDescription
valueboolA boolean value

Output

NameTypeDescription
valueboolThe logical negation of the input boolean value

On this page