The analyzer detected equivalent expressions for the same case within the switch statement.
The example:
switch {
case s == "start", s == "start":
Start()
case s == "stop":
Stop()
}
Using equivalent expressions likes == "start" makes no sense.
true, control flow enters the branch, bypassing the second expression.false, the second expression will evaluate the same way, and control flow will skip this entire branch.Most likely, this is a typo, and the second equivalent expression should be something else.
The fixed code:
switch {
case s == "start", s == "begin":
Start()
case s == "stop":
Stop()
}
Was this page helpful?