Use switch statements for functional operators

This is safer than using an `if` statement. And it looks better.