How to compare and switch