Use

Gleam lacks exceptions, macros, type classes, early returns, and a variety of other features, instead going all-in with just first-class-functions and pattern matching. This makes Gleam code easier to understand, but it can sometimes result in excessive indentation.

Gleam's use expression helps out here by enabling us to write code that uses callbacks in an unindented style, as shown in the code window.

The higher order function being called goes on the right hand side of the <- operator. It must take a callback function as its final argument.

The argument names for the callback function go on the left hand side of the <- operator. The function can take any number of arguments, including zero.

All the remaining code in the enclosing {} block becomes the body of the callback function.

This is a very capable and useful feature, but excessive application of use may result in unclear code, especially to beginners. Usually the regular function call syntax results in more approachable code!