Hacker News new | ask | show | jobs
by mbishop 3006 days ago
How to do this in a for-loop:

  for (int 1 = 0; i < length; i++) {
    if (checkError(i))
      continue;
  
    ... // happy path
  }
You can also use a return statement inside the for-loop if you want to exit the entire function.