Traversal

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

Output:

a
b
c

Last updated