sage: for m,n in CartesianProduct(range(2), range(3)):
....:         p = 2*m
....:     print p
....:     if p==2:
....:         m = 4
....:         break
....:     if n==1:
....:         os._exit(0)
....: 
0
0


On Tuesday, November 20, 2012 6:48:14 PM UTC, 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:
>      print 'I want to stop Sage'
> print 'Did not stop Sage'
>
> I want to get out of m loop if p=2 and totally stop Sage if n=1.
> Thanks so much for any help.  Sorry if this is a dumb question. I looked 
> and looked.
>
> BTW: Someone might want to add this good tutorial: 
> http://modular.math.washington.edu/msri06/stein/tut.pdf to 
> http://ask.sagemath.org/question/1086/where-is-basic-tutorial-for-sage
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
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.
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to