On Wed, Feb 23, 2011 at 10:54 PM, Jason Grout
<[email protected]> wrote:
> On 2/24/11 12:49 AM, Santanu Sarkar wrote:
>
>
>> In ' while ' or ' for ' loop in Sage, can one use ' { ' and ' } ' like C
>> program?
>
> No.  In Python (the language you are using when you write Sage code) use
> indentation to indicate blocks of code.
>
> for i in range(100):
>    print i
>    print i^2
>
> See
> http://docs.python.org/tutorial/introduction.html?highlight=indentation#first-steps-towards-programming
> for a longer introduction.
>

You an also use comments if you want to have some sort of explicit end
marker.

for i in range(100):
   print i
   print i^2
# end for

I used to do that when I was first learning Python.

William

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to