Skip to main content

less-than (<)

Use < to return true if the first oper1 argument is less than the second oper2 argument.

Basic syntax

To check if oper1 is less than oper2, use the following syntax:

(< oper1 oper2)

Arguments

Use the following arguments to specify the values for comparison using the < Pact function.

ArgumentTypeDescription
oper1integer, decimal, string, or timeSpecifies the first value for comparison.
oper2integer, decimal, string, timeSpecifies the second value for comparison.

Return value

The < function returns a boolean value indicating whether oper1 is less than oper2.

Examples

The following example demonstrates how to use the < function to compare two integer values to check if the first value (1) is less than the second value (3)::

pact> (< 1 3)
true

The following example demonstrates how to use the < function to compare two decimal values to check if the first value (5.24) is less than the second value (2.52):

pact> (< 5.24 2.52)
false

The following example demonstrates how to use the < function to compare two string values to check if the first value (abc) is less than the second value (def):

pact> (< "abc" "def")
true