Lucky hour! Grab a free trial license — offer ends in 00:59:58. Claim now
The analyzer has detected a potential error in a construction consisting of conditional instructions. The error is caused by repeated if conditions, which may result in the code within that branch becoming unreachable.
The example:
const (
MONDAY = "Monday"
TUESDAY = "Tuesday"
WEDNESDAY = "Wednesday"
THURSDAY = "Thursday"
FRIDAY = "Friday"
)
if day == MONDAY {
....
} else if day == TUESDAY {
....
} else if day == WEDNESDAY {
....
} else if day == THURSDAY {
....
} else if day == MONDAY {
....
}
In the example, there are two if constructions with the same condition. If control flow reaches the second condition, it will always evaluate as false, making all code in the corresponding branch unreachable.
The fixed code:
if day == MONDAY {
....
} else if day == TUESDAY {
....
} else if day == WEDNESDAY {
....
} else if day == THURSDAY {
} else if day == FRIDAY {
....
}
This diagnostic is classified as:
You can look at examples of errors detected by the V8004 diagnostic. |
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders: