It's mostly a matter of personal preference whether you use if... elseif... or switch. The results are the same. Switch makes sense if all of your conditions are of the form x == value, with x being the same in all of them.