+ 1

Why “error” prints in last

I don’t know why and how “else” part is executed that is outside of loop ...plz explain đŸ„Č https://code.sololearn.com/ckIoqzH6CBeG/?ref=app

18th Feb 2021, 1:43 PM
Sarthak
Sarthak - avatar
4 Answers
+ 1
Abol if the for loop terminates by break statement then else doesn't executes. For example change it to x==5 and else won't execute,
18th Feb 2021, 2:56 PM
Abhay
Abhay - avatar