create a switch statement like construct