Our website uses cookies to enhance your browsing experience.
Accept
to the top

Webinar: Let's make a programming language. Lexer - 29.04

>
>
>
V8014. Two 'if' statements have...
menu mobile close menu
Additional information
toggle menu Contents

V8014. Two 'if' statements have identical conditions. The first 'if' statement contains function return, making the second 'if' redundant, or the code contains a logical error.

Apr 03 2026

The analyzer has detected that the then branch of the if statement is never executed. This happens because the code already contains an if statement with the same condition, which includes an unconditional return in the then branch. This situation may indicate a logical error in the program or that the second if statement is redundant.

Look at the example of the incorrect code:

if l >= 0x06C0 && l <= 0x06CE {
  return true
}
if l == 0x06D5 {                 // <=
  return true
}
if l >= 0x0905 && l <= 0x0939 {
  return true
}
if l == 0x06D5 {                 // <=
  return true
}
if l >= 0x0985 && l <= 0x098C {
  return true
}

In this case, the l == 0x06D5 condition is duplicated, and fixing the code only requires removing one of the checks. However, it is also possible that the second check was meant to be compared to a different value than the first.

The fixed code:

if l >= 0x06C0 && l <= 0x06CE {
  return true
}
if l == 0x06D5 {
  return true
}
if l >= 0x0905 && l <= 0x0939 {
  return true
}
if l >= 0x0985 && l <= 0x098C {
  return true
}