code using else and if