While I was writing a private helper method in Java, I needed to add a check for a precondition that would cause the method to do nothing if not met. The last few lines of the method were just off the bottom of the editing area in the IDE, so in an epic display of laziness, I wrote the check like this:
function(){
if (precondition == false){
return;
}
//Do stuff
}
as to opposed finding the end of the block to write a more "traditional" statement like this:
function(){
if (precondition == true){
//Do stuff
}
}
This made me wonder: is there a reason to avoid my version in favor of the other, or is it just a stylistic difference? (Assuming they are used in such a way that they are meant to be functionally equivalent)