A chain of if/else
if statements is evaluated from top to bottom. At most, only one branch will be executed: the first statement with a condition that evaluates to
true
. Therefore, duplicating a condition leads to unreachable code inside the duplicated condition block. Usually, this is due to a
copy/paste error.
The result of such duplication can lead to unreachable code or even to unexpected behavior.