I do not understand here. What is the pattern matching here?

I mean I think my way of doing this is the only way.