How to assign the value of a switch statement to a variable

There is a pitch for this: if/else expression, switch/case expression