filmov
tv
Python Loops: For Loop Syntax and Code Examples
Показать описание
Numeric Range Loop
The most basic for loop is a simple numeric range statement with start and end values. The exact format varies depending on the language but typically looks something like this:
for i = 1 to 10
loop body
Here, the body of the loop is executed ten times. The variable i assumes the value 1 on the first iteration, 2 on the second, and so on. This sort of for loop is used in the languages BASIC, Algol, and Pascal.
The most basic for loop is a simple numeric range statement with start and end values. The exact format varies depending on the language but typically looks something like this:
for i = 1 to 10
loop body
Here, the body of the loop is executed ten times. The variable i assumes the value 1 on the first iteration, 2 on the second, and so on. This sort of for loop is used in the languages BASIC, Algol, and Pascal.