O'Reilly logo

Programming Elixir by Dave Thomas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Your Turn

  • Exercise: PatternMatching-2

    Which of the following will match?

    • [ a, b, a ] = [ 1, 2, 3 ]

    • [ a, b, a ] = [ 1, 1, 2 ]

    • [ a, b, a ] = [ 1, 2, 1 ]

  • Exercise: PatternMatching-3

    If you assume the variable a initially contains the value 2, which of the following will match?

    • [ a, b, a ] = [ 1, 2, 3 ]

    • [ a, b, a ] = [ 1, 1, 2 ]

    • a = 1

    • ^a = 2

    • ^a = 1

    • ^a = 2 - a

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required