Why don't you switch/case directly instead of doing a if() first ?