Store the position of the switch in a flow variable (use a change node to set flow.switch to value of msg.payload)
Then use a switch node with 2 entries that check the value of flow.switch
If you are just learning node-red, I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.