Use if-else instead of switch condition for bool variable