0

Spam Eggs?

Hello! Why string if end == 'N' or end == 'n': break causes an error 'break outside the loop'?? In other my programs of similar error with this syntax like as well as not :/

7th Mar 2018, 8:17 AM
Non
Non - avatar
5 Answers
+ 1
maybe because: 1) it is used inside a loop or 2) there has not been a 404 input yet. As Python is a dynamic language, all code is analysed at RUNTIME. There is no compile time
7th Mar 2018, 8:42 AM
Amaras A
Amaras A - avatar
+ 1
welcome
7th Mar 2018, 8:46 AM
Amaras A
Amaras A - avatar
0
The break keyword has to be used inside a loop construct, either for or while
7th Mar 2018, 8:26 AM
Amaras A
Amaras A - avatar
0
But why string x = input("\n... : ") if x == "404": break Does not cause an error "break outside loop" ?
7th Mar 2018, 8:39 AM
Non
Non - avatar
0
Thx!
7th Mar 2018, 8:46 AM
Non
Non - avatar