Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+16 votes
asked in CSC211_Winter2018 by (8 points)

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 (302 points)
selected by
+4 votes

Are you talking about infinite loops?

answered by (-492 points)

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