0
Anyone can explain the logic of the last "else"?
here is a code which will print "great!" after 3 times of "yes!", but I don't understand the logic of the last "else". How can it happened when theres no "if" on the outside. Thanks! https://code.sololearn.com/cbchbECGyqCB/?ref=app
3 Answers
+ 4
If the loop is completed successfully then else run in for else statement and if the loop is braked then else never runs
0
"The else block just after for/while is executed only when the loop is NOT terminated by a break statement."
great, I understand now, thank you so muchđ