Skip for loop when if statement is met inside for loop?

You could use the break keyword for (int I = 0; I.

You could use the break keyword. For (int I = 0; I.

1 Well, a break is probably as gotoish as a return statement within an if. Apart from this, the first approach is much more readable, so I would recommend using the tools the language provides you with. – frenetisch applaudierend Mar 19 at 11:29 1 I highly suggest you to read Dijkstra one-entry-point and one-exit-point view on structured programming.

– Alexis Mar 19 at 11:36 1 I did, but I cannot say that I am the same opinion as he is when it comes to one exit point. If you need to resort to superfluous boolean variables just to replace a well placed return statement, then in my opinion it's the wrong way to go. – frenetisch applaudierend Mar 19 at 11:42 1 Well, my point is more likely "review your design" before doing either version of the code you or I suggested.

Gotoish code tends to make work harder since you got to understand the possible context bump on a big legacy app. – Alexis Mar 19 at 11:49 1 Agreed, if you need to make frequent early returns, then maybe a refactoring is needed. – frenetisch applaudierend Mar 19 at 11:55.

What I have is this – mohsen Mar 21 at 7:39.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send