Answer the question
In order to leave comments, you need to log in
How to exit nested loop on certain event?
How do I exit the last loop when I get one event
of the loops above?
After all, after the last cycle starts, the processing of events from the upper cycles stops
longpoll = VkLongPoll(vk_session)
while True:
for event in longpoll.listen():
while True:
#какой-то код
Answer the question
In order to leave comments, you need to log in
Wrap it in a function and exit on return, another option is to exit on the label using goto
try-except construct can help. To exit by condition, you must throw an exception.
Python Try Except
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question