'goto' in micropython

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
pythoncoder
Posts: 4014
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: 'goto' in micropython

Post by pythoncoder » Sat Feb 29, 2020 6:18 am

That is fine for exiting a single loop (break, while not the same, can also be used). But the OP was about breaking out of nested loops.
Peter Hinch

OutoftheBOTS_
Posts: 731
Joined: Mon Nov 20, 2017 10:18 am

Re: 'goto' in micropython

Post by OutoftheBOTS_ » Sat Feb 29, 2020 8:51 am

I use it for nested loop. I use break if needed to exit from current loop but if need to exit from higher loops I will set an exit flag for which ever higher loops I need to break out off

Post Reply