On 10/12/2011 8:41 PM, Max S. wrote:
I've been doing some research into C++, and I've noticed the for
loops. Is there a way to use the C++ version of the loops instead of
the Python one? For example, I believe that the Python syntax would be:
for a=1, a < 11, a += 1:
print(a)
print("Loop ended.")
if the 'for' keyword did it's function as in C++, Actionscript, or
most other programming languages. Is there a way to do this?
for i in range(1, 11, 1): # the final 1 can be omitted, as it is the
default value.
loop body
OR
i = 1
while i < 11:
i += 1
loop body
Your choice - that's all know of - and the for is easier to read and
write than the while.
--
Bob Gailer
919-636-4239
Chapel Hill NC
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor