How to use pattern matching conditioning