Both seem to accomplish the same thing--exit a subroutine. Is there any difference in how they work under the covers?
I.e.
Private Sub exitNow()
Exit Sub
End Sub
or
Private Sub exitNow()
Return
End Sub
Both seem to accomplish the same thing--exit a subroutine. Is there any difference in how they work under the covers?
I.e.
Private Sub exitNow()
Exit Sub
End Sub
or
Private Sub exitNow()
Return
End Sub
I haven't disassembled but I'll bet there's no difference. Why would there be?
From the doc:
In a Sub or Set procedure, the Return statement is equivalent to an Exit Sub or Exit Property statement, and expression must not be supplied.
So they're the same in this context.
While there are exceptions like guard clauses, in most cases I would consider either a sign that the method is too long.