Skip to content

Programming with Expressions

Working with basic types

Blabla.

Text

You can concatenate various text values by using the '+' operator.

'Hello' + ', ' + 'World!'

Numbers

Integer, Long, BigIntegers

7   // an integer
7L  // a long
BigInteger('7')

You can work with numbers using arithmetic operators.

4 * 10 + 2
100 / 7
100 % 7

yearsBetween(dateOfBirth, today)
{
    let numbers = [ 10, 100, 142, 47];
    numbers.sum
}

Floating point numbers

4.0 * 10 + 2
100.0 / 7.0

BigDecimals

BigDecimal('3010.45')

Dates

Date(2026, 11, 30)
DateTime(2026, 11, 30, 12, 0, 0)

Immutable values, blocks

{
    let x = 41;
    x + 1
}

Working with collections

Tuples

Options

List and non empty list

[]      // an empty list
['This', 'is', 'a', 'list', 'of', 'text']  // List[Text]

Ranges

IRange(0, 10)   // An inclusive range that contains its min and max bounds
ERange(0, 10)   // An exclusive range that does not contain its min and max bounds

The following expression will compute the sum of all integer numbers from 1 to n = 1 + ... + n

IRange(1, n).sum

Sets

Set('a', 'b', 'c')

Maps

Working with business entities

Higher order functions

Lambda expressions

{
    let criteriaSatisfied = c: Customer => c.age >= 18;
    if criteriaSatisfied(joe) 'You are eligibile' 
    else 'Sorry, you are not eligible'
}

Map, filter

  • Transforming while keeping the structure
  • ...
IRange(0, 100).

For comprehensions

  • with filtering condition
  • with type filters