using each method with switch statement