News for hackers. Stuff that matters.
Re:Goto (2007) by idiocrat on Thursday October 21, 2021 @08:10PM (#28952394)
The times I found I used the goto statements are retrials.

For example, if a file is locked for writing, I want to wait for 5, then 10, then 15 seconds, retrying each time, before giving up.

In such case I do not want the retrials loop to be my main control structure.

Instead, I jump from inside the IO exception catch block to the ReTry label, restarting the whole operation.

This makes the flow fairly clean.

There are no comments on this comment yet.