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

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

>
>
>
V8006. Unconditional...
menu mobile close menu
Additional information
toggle menu Contents

V8006. Unconditional 'break/continue/return/goto' within a loop.

Apr 03 2026

The analyzer has detected a suspicious loop where one of the following statements is executed unconditionally: continue, break, return, goto.

The example:

for i := 0; i < max; i++ {                
  if i == index {
    value += Calculate(i)
  }
  break
}

In this code, the break statement does not belong to the if statement body, so it runs whether the i == index condition is true. As a result, the loop body always executes only once.

The fixed code may look like this:

for i := 0; i < max; i++ {                
  if i == index {
    value += Calculate(i)
    break
  }
}