Implementing pattern matching

Determine the output of the given code snippet in Elixir.

[head | _] = [3,6,9] #line1

head * 2 #line2

_ * 3 #line3

Options

1.[6,12,18]

[9,18,27]

2.[3,6,9]

[3,6,9]

3.Compilation error at line 1

4.Compilation error at line 2

5.Compilation error at line 3

Related Posts

Close Bitnami banner
Bitnami