Private someSub()
If someBoolean = True Then Exit Sub
' do some great work because someBoolean is False
End Sub
I know there is a name for this. The idea is to check something and if it isn't what you want then you stop code processing. I thought it was called "escape pattern", but Google isn't confirming that name.
guard clause:
http://c2.com/cgi/wiki?GuardClause
Hmm...I've heard it called "early exit" (though mostly in the context of loops), but I'd consider it not so much a pattern as a technique.
As an aside, you could simplify your code by removing the "= True" in your conditional.
Private someSub()
If someBoolean Then Exit Sub
' do some great work because someBoolean is False
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With