On Thu, Jul 23, 2009 at 12:31 PM, mac8090<bonzerpot...@hotmail.com> wrote: > How does one break from a double for loop, or a loop of two variables?
One way is to use an exception: class GetOut(Exception): pass try: for x in range(10): for y in range(10): if 2^x*3^y==12: raise GetOut except GetOut: pass print x, y $ sage foo.sage 2 1 -- Carlo Hamalainen http://carlo-hamalainen.net --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---