Skip to main content

Use of "switch" as a conditional

1 min read

This switch thingy is a very useful tool, because instead of nesting many conditionals, you can be very specific, on the response of the program in which case.

As you can see you can add as many cases as you want, but you need to add "break" at the end, if not the default answer will also show up, that why when I typed in 3 goals, it shows the two answers.

If you get the hang of this tool, you will have many posible solutions for coding issues you may find.