java - for each loop with a second boolean parameter -
this question has answer here:
- java foreach condition 6 answers
is there here know how this:
boolean condition = true; for(int i=0; i<list.size() && condition; i++){ if (***) condition = false; }
with each loop, that:
boolean condition = true; for(string s : list && condition){ if (***) condition = false; }
i know second loop not work, have same behaviour without using killing mortal ugly instruction "break".
use break statement:
for(string s: list) { if (....) { break; } }
btw can kind of loop , imho preferable because more readable.
Comments
Post a Comment