Switch cases in go can use fallthrough
keyword to fall into next
case without checking it’s condition if the current case has
fallthrough statement at the end.
For example:
|
|
The output is,
big positive number
“fallthrough” can be used in scenario where the block of both cases are same. It avoids duplication of code.