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.
Arrow Functions in Twig is made up of the following videos: