Here's a simple example:
if (a) {
option = a.getOption();
normalizeOption(option);
prepareOption(option);
processOption(option);
renderOption(option);
}
elseif (b) {
option = b.getOption();
prepareOption(option);
processOption(option);
renderOption(option);
}
else {
option = null;
}
could be written as:
if (a) {
option = a.getOption();
normalizeOption(option);
}
elseif (b) {
option = b.getOption();
}
finally {
prepareOption(option);
processOption(option);
renderOption(option);
}
else {
option = null;
}
This would come in handy so often that I almost want to modify some open-source compiler to recognize these constructs. I've come across better examples but I can't think of them right now. Try coming up with some of your own.