0

In my subs, I usually perform several forms of validation before proceeding with the sub. Is it a bad habit to exit the sub? For example:

Private Sub mySub()

    if Not Validated() then
        exit sub
    end if

   'do stuff
End sub

Would it be better to enclose the entire body in an If-Then statement?

private sub mySub()
    if validated then
       'do stuff
     end if
end sub
Thomas Bailey
  • 151
  • 1
  • 5
  • 2
    What about [`Return`](https://docs.microsoft.com/en-us/dotnet/articles/visual-basic/language-reference/statements/return-statement)? – tadman May 18 '17 at 19:32
  • No. in fact it is easier to read. (Or use Return as Tadman says) – TyCobb May 18 '17 at 19:32

0 Answers0