Andrew gives an overview of arrow functions in Twig.
What is an arrow function?
Here’s an example of an arrow function (in generic code):
(value) => value * 5
This is what it would look like as a regular function:
function calc(value) {
return value * 5
}
As you can see, the arrow function version is a more succint way of writing the same thing. Notice that there’s no explicit return statement in the arrow function, like there is in the second example.

Andrew is a regular contributor to CraftQuest through the CraftQuest on Call livestream. He's the developer behind the most popular Craft CMS plugins, like SEOmatic and Retour. Andrew has decades of experience in software development for both web and client applications.