All lessons

Linked Lists

8 min · Elixir examples

Chain nodes with next pointers: traverse, count, and update without shifting a whole array.

Elixir · Linked Lists0/5 cleared

Enemy 1 of 5

This builds a chain of three nodes, each pointing to the next, then walks from the first node to the end while counting them. Press Run to see the count printed.

Why this works

In Elixir, linked lists are the default list type. Each cell is a head and a tail.

Walk with pattern matching or use length/1 for counting when learning the idea.

You
Syntax Skeleton
Loading editor…
Sign up to fightThis one runs on our servers, so it needs a free account.