rewrite if statement in one line