How does match? function work in kernel.ex

Wondering how match? does what it does, does anyone know of an explanation, or can anyone walk me through the code?

Thanks!

1 Like

Basically it just converts this:

result = match?(a, b)

Into this:

result =
  case b do
    a ->
      true
    _ ->
      false
  end

So it just tests if the left argument matches the right argument via a case expression, and if it does it returns true, if it does not then it returns false. :slight_smile:

5 Likes

Thanks, OvermindDL1.

Got it.

2 Likes