All lessons

Power Tools: Anonymous Functions, Enum & the Pipe Operator

10 min · Elixir

Write inline functions, transform lists with Enum, and chain steps with |>.

Elixir · Power Tools: Anonymous Functions, Enum & the Pipe Operator0/5 cleared

Enemy 1 of 5

An anonymous function is written fn params -> body end, and called with a dot: square.(6). Handy for a quick calculation you don't want to name.

You
Syntax Skeleton

Loading editor...

Ln 1, Col 1Spaces: 4
Sign up to fightTarget output: 36