[sage-support] How do you stop sage in the middle of a block?

2012-11-20 Thread LFS
How do you get sage out of a loop early? How do you get sage to totally stop in the middle of a block? for n in (0..2): for m in (0..3): p=2*m print p if p==2: print 'I want out of loop' m=4 if n==1: print 'I want to stop Sage' print 'Did not stop Sage' I want to get o

Re: [sage-support] How do you stop sage in the middle of a block?

2012-11-20 Thread William Stein
On Tue, Nov 20, 2012 at 10:48 AM, LFS wrote: > How do you get sage out of a loop early? > How do you get sage to totally stop in the middle of a block? > > for n in (0..2): > for m in (0..3): >p=2*m >print p >if p==2: > print 'I want out of loop' > m=4 > if n==1: > p

Re: [sage-support] How do you stop sage in the middle of a block?

2012-11-20 Thread Anton Sherwood
On 2012-11-20 10:48, LFS wrote: How do you get sage out of a loop early? How do you get sage to totally stop in the middle of a block? Two ways have been mentioned; yet another is a custom Exception: class IWantOut(Exception): pass try: loop ... ...