4 ms·
Ask HN: Why goto Still Exists in C#?
- rmk 5y agoBecause it's good to use goto in some situations? It's perfectly fine to use goto when using the procedural programming paradigm. It's common to goto an 'error' label (from any number of spots within the procedure) to do cleanups before returning. This technique is used in C programs (see Linux Kernel code example here: https://github.com/torvalds/linux/blob/master/fs/ext4/block_validity.c#L211 https://github.com/torvalds/linux/blob/master/fs/ext4/block_...)