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.
Follow along with the full transcript
Search every word, click any line to jump to that moment, and read along as you watch — a CraftQuest Premium feature.
Sign up for Premium