squid:S135 - "one break AND continue" or "one break OR continue"

Hi, SonarLint rule squid:S135 mentions that
Restricting the number of break and continue statements in a loop is done in the interest of good structured programming.
One break AND continue statement is acceptable in a loop, since it facilitates optimal coding. If there is more than one, the code should be refactored to increase readability.

I would like to enquire whether the rule means “not more than one break AND not more than one continue” or “not more than one break OR not more than one continue”. A simple representation of my code is as follows:

for(String a: listOfString){
  if(*boolean expression*){
  if(*boolean expression*){

Hi Low,

I updated RSPEC-135 to clarify what the rule implementation does by replacing:
One break and continue statement is acceptable in a loop
Only one break or one continue statement is acceptable in a loop

Thanks for the feedback.

1 Like

Thanks and welcome.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.