IfElse in class