A way of simulating switch statement