Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+16 votes
asked in CSC211_Winter2018 by (1 point)

2 Answers

+9 votes
Best answer

Technically, yes, there is a way. Depending on what you are asking, either the continue or break commands might be what you are thinking of.

HOWEVER, using these commands inside of FOR loop is almost always a sign of poor coding style. Why can't you just have the FOR loop go fewer cycles instead, by changing the condition (i.e. i <= 5 instead of i <= 7)?

answered by (508 points)
selected by
+4 votes

Are you talking about infinite loops?

answered by (-499 points)

No, I'm just wondering if there's a way that a normal for-loop can be cut off at a certain point.