Go switch
Jump to navigation
Jump to search
Internal
Overview
Same as for if
, switch
accepts an optional initialization statement.
The cases are evaluated top to bottom until a match is found. The expressions need not be constants or even integers.
It is idiomatic to write an if
-else
-if
-else
as a switch
.