Less-than operation

Learn how to check if a value is less than another.

The less than operation checks whether one value is less than another. You can use it to compare numbers, strings, dates, or any other value that has a concept of order.

To compare two values, place the < operator between them:

/*<operand>*/ < /*<operand>*/
Try in Playground

Here's a practical example involving numbers:

0 < 1 // true
Try in Playground

You can also compare strings alphabetically:

"a" < "b" // true
Try in Playground

And dates chronologically:

today < tomorrow // true
Try in Playground

Although there is no natural language equivalent to the < operator, you can use the less than test for a more natural reading:

/*<operand>*/ is less than /*<operand>*/
Try in Playground

Note that operations and tests may differ in their behavior and precedence. Please refer to the documentation of each specific operation and test for more information.