+ 1
Could someone explane the example from battle?
don't understand 2 moments: 1. Why the "for" do only 1 iteration? 2. what do "break"? whithout "break" nothing happpened))) https://code.sololearn.com/cw2j3MRB8777/?ref=app
3 Respuestas
+ 1
1. It is because of the fact that for loop in its first run returned some value & hence the code after return statement remained unexeceuted!
2. After the return statement, there is no sense of break keyword ;)
In normal cases, inside a loop structure (like a for loop or a while loop), break keyword stops further execution of the code, and jumps out of the loop!
+ 1
and "return" so stop a loop as a "break"?
+ 1
english is difficult for me))))