> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/s/singly-linked-list/traversal.md).

# Traversal

```ruby
var list = 'a':'b':'c':nil
#var list = ['a', ['b', ['c']]]
#var list = Pair('a', Pair('b', Pair('c', nil)))
 
for (var l = list; l != nil; l = l[1]) {
    say l[0]
}
```

#### Output:

```
a
b
c
```
