Do you know not to put Exit Sub before End Sub? (VB)

Updated by Brook Jeynes [SSW] 2 years ago. See history

123
No component provided for introEmbed
Private Sub SomeSubroutine()
'Your code here....
Exit Sub ' Bad code - Writing Exit Sub before End Sub.
End Sub

❌ Figure: Bad example

Private Sub SomeOtherSubroutine()
'Your code here....
End Sub

✅ Figure: Good example

We have a program called SSW Code Auditor to check for this rule.

Acknowledgements

Adam Cogan
Related rules

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.

We open source.Loving SSW Rules? Star us on GitHub. Star