Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upNew rule to warn against break/continue outside of loops or traps #1507
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From PowerShell/PowerShell#12742.
Today
breakwill take control out of a function and up to the first loop in the callstack, possibly exiting the whole script.Some existing code depends on this, but it's not a good behaviour.
Ideally a rule should warn about this, since using it
breakoutside a loop or trap is usually a mistake that could seriously affect the program.