change a function begun `if`
Merge pull request #2 from kazeula/feature/no_if

refactor a function begun `if` into a pattern match function