5 ms·
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, retryi
by idiocrat 5y ago
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.