<s>
In	O
computer	B-General_Concept
science	I-General_Concept
a	O
for-loop	B-Language
or	O
for	B-Language
loop	I-Language
is	O
a	O
control	O
flow	O
statement	O
for	O
specifying	O
iteration	B-Algorithm
.	O
</s>
<s>
Specifically	O
,	O
a	O
for	B-Language
loop	I-Language
functions	O
by	O
running	O
a	O
section	O
of	O
code	O
repeatedly	O
until	O
a	O
certain	O
condition	O
has	O
been	O
satisfied	O
.	O
</s>
<s>
For-loops	B-Language
have	O
two	O
parts	O
:	O
a	O
header	O
and	O
a	O
body	O
.	O
</s>
<s>
The	O
header	O
defines	O
the	O
iteration	B-Algorithm
and	O
the	O
body	O
is	O
the	O
code	O
that	O
is	O
executed	O
once	O
per	O
iteration	B-Algorithm
.	O
</s>
<s>
This	O
allows	O
the	O
body	O
to	O
know	O
which	O
iteration	B-Algorithm
is	O
being	O
executed	O
.	O
</s>
<s>
For-loops	B-Language
are	O
typically	O
used	O
when	O
the	O
number	O
of	O
iterations	B-Algorithm
is	O
known	O
before	O
entering	O
the	O
loop	O
.	O
</s>
<s>
For-loops	B-Language
can	O
be	O
thought	O
of	O
as	O
shorthands	O
for	O
while-loops	O
which	O
increment	O
and	O
test	O
a	O
loop	O
variable	O
.	O
</s>
<s>
Various	O
keywords	O
are	O
used	O
to	O
indicate	O
the	O
usage	O
of	O
a	O
for	B-Language
loop	I-Language
:	O
descendants	O
of	O
ALGOL	B-Language
use	O
"	O
for	O
"	O
,	O
while	O
descendants	O
of	O
Fortran	B-Application
use	O
"	O
do	O
"	O
.	O
</s>
<s>
There	O
are	O
other	O
possibilities	O
,	O
for	O
example	O
COBOL	B-Application
which	O
uses	O
"	O
PERFORM	O
VARYING	O
"	O
.	O
</s>
<s>
The	O
name	O
for-loop	B-Language
comes	O
from	O
the	O
word	O
for	O
.	O
</s>
<s>
For	O
is	O
used	O
as	O
the	O
keyword	O
in	O
many	O
programming	O
languages	O
to	O
introduce	O
a	O
for-loop	B-Language
.	O
</s>
<s>
The	O
term	O
in	O
English	O
dates	O
to	O
ALGOL	B-Language
58	I-Language
and	O
was	O
popularized	O
in	O
ALGOL	B-Language
60	I-Language
.	O
</s>
<s>
It	O
is	O
the	O
direct	O
translation	O
of	O
the	O
earlier	O
German	O
and	O
was	O
used	O
in	O
Superplan	B-Language
(	O
1949	O
–	O
1951	O
)	O
by	O
Heinz	O
Rutishauser	O
.	O
</s>
<s>
Rutishauser	O
was	O
involved	O
in	O
defining	O
ALGOL	B-Language
58	I-Language
and	O
ALGOL	B-Language
60	I-Language
.	O
</s>
<s>
This	O
is	O
more	O
explicit	O
in	O
ALGOL	B-Language
versions	O
of	O
the	O
for	B-Language
statement	I-Language
where	O
a	O
list	O
of	O
possible	O
values	O
and	O
increments	O
can	O
be	O
specified	O
.	O
</s>
<s>
In	O
Fortran	B-Application
and	O
PL/I	B-Language
,	O
the	O
keyword	O
DO	O
is	O
used	O
for	O
the	O
same	O
thing	O
and	O
it	O
is	O
called	O
a	O
do-loop	O
;	O
this	O
is	O
different	O
from	O
a	O
do-while	O
loop	O
.	O
</s>
<s>
A	O
for-loop	B-Language
statement	O
is	O
available	O
in	O
most	O
imperative	B-Application
programming	I-Application
languages	I-Application
.	O
</s>
<s>
Even	O
ignoring	O
minor	O
differences	O
in	O
syntax	B-Application
there	O
are	O
many	O
differences	O
in	O
how	O
these	O
statements	O
work	O
and	O
the	O
level	O
of	O
expressiveness	O
they	O
support	O
.	O
</s>
<s>
Generally	O
,	O
for-loops	B-Language
fall	O
into	O
one	O
of	O
the	O
following	O
categories	O
:	O
</s>
<s>
The	O
for-loop	B-Language
of	O
languages	O
like	O
ALGOL	B-Language
,	O
Simula	B-Language
,	O
BASIC	O
,	O
Pascal	B-Application
,	O
Modula	B-Language
,	O
Oberon	B-Language
,	O
Ada	B-Language
,	O
Matlab	B-Language
,	O
Ocaml	B-Language
,	O
F#	B-Operating_System
,	O
and	O
so	O
on	O
,	O
requires	O
a	O
control	B-General_Concept
variable	I-General_Concept
with	O
start	O
-	O
and	O
end-values	O
,	O
which	O
looks	O
something	O
like	O
this	O
:	O
</s>
<s>
An	O
optional	O
step-value	O
(	O
an	O
increment	O
or	O
decrement	O
≠	O
1	O
)	O
may	O
also	O
be	O
included	O
,	O
although	O
the	O
exact	O
syntaxes	B-Application
used	O
for	O
this	O
differs	O
a	O
bit	O
more	O
between	O
the	O
languages	O
.	O
</s>
<s>
Some	O
languages	O
require	O
a	O
separate	O
declaration	O
of	O
the	O
control	B-General_Concept
variable	I-General_Concept
,	O
some	O
do	O
not	O
.	O
</s>
<s>
Another	O
form	O
was	O
popularized	O
by	O
the	O
C	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
It	O
requires	O
3	O
parts	O
:	O
the	O
initialization	O
(	O
loop	B-Application
variant	I-Application
)	O
,	O
the	O
condition	O
,	O
and	O
the	O
advancement	O
to	O
the	O
next	O
iteration	B-Algorithm
.	O
</s>
<s>
This	O
type	O
of	O
"	O
semicolon	O
loops	O
"	O
came	O
from	O
B	B-Language
programming	I-Language
language	I-Language
and	O
it	O
was	O
originally	O
invented	O
by	O
Stephen	O
Johnson	O
.	O
</s>
<s>
The	O
advancement	O
to	O
the	O
next	O
iteration	B-Algorithm
part	O
is	O
performed	O
exactly	O
once	O
every	O
time	O
the	O
loop	O
ends	O
.	O
</s>
<s>
Here	O
is	O
an	O
example	O
of	O
the	O
C-style	O
traditional	O
for-loop	B-Language
in	O
Java	B-Language
.	O
</s>
<s>
These	O
loops	O
are	O
also	O
sometimes	O
called	O
numeric	O
for-loops	B-Language
when	O
contrasted	O
with	O
foreach	O
loops	O
(	O
see	O
below	O
)	O
.	O
</s>
<s>
This	O
type	O
of	O
for-loop	B-Language
is	O
a	O
generalisation	O
of	O
the	O
numeric	O
range	O
type	O
of	O
for-loop	B-Language
,	O
as	O
it	O
allows	O
for	O
the	O
enumeration	O
of	O
sets	O
of	O
items	O
other	O
than	O
number	O
sequences	O
.	O
</s>
<s>
A	O
representative	O
example	O
in	O
Python	B-Language
is	O
:	O
</s>
<s>
Where	O
is	O
either	O
a	O
data	O
collection	O
that	O
supports	O
implicit	O
iteration	B-Algorithm
(	O
like	O
a	O
list	O
of	O
employee	O
's	O
names	O
)	O
,	O
or	O
may	O
in	O
fact	O
be	O
an	O
iterator	O
itself	O
.	O
</s>
<s>
Some	O
languages	O
have	O
this	O
in	O
addition	O
to	O
another	O
for-loop	B-Language
syntax	B-Application
;	O
notably	O
,	O
PHP	O
has	O
this	O
type	O
of	O
loop	O
under	O
the	O
name	O
,	O
as	O
well	O
as	O
a	O
three-expression	O
for-loop	B-Language
(	O
see	O
below	O
)	O
under	O
the	O
name	O
.	O
</s>
<s>
Some	O
languages	O
offer	O
a	O
for-loop	B-Language
that	O
acts	O
as	O
if	O
processing	O
all	O
iterations	B-Algorithm
in	B-General_Concept
parallel	I-General_Concept
,	O
such	O
as	O
the	O
keyword	O
in	O
FORTRAN	B-Application
95	O
which	O
has	O
the	O
interpretation	O
that	O
all	O
right-hand-side	O
expressions	O
are	O
evaluated	O
before	O
any	O
assignments	O
are	O
made	O
,	O
as	O
distinct	O
from	O
the	O
explicit	O
iteration	B-Algorithm
form	O
.	O
</s>
<s>
Some	O
languages	O
(	O
such	O
as	O
FORTRAN	B-Application
95	O
,	O
PL/I	B-Language
)	O
also	O
offer	O
array	O
assignment	O
statements	O
,	O
that	O
enable	O
many	O
for-loops	B-Language
to	O
be	O
omitted	O
.	O
</s>
<s>
But	O
whether	O
that	O
would	O
be	O
rendered	O
in	O
the	O
style	O
of	O
the	O
for-loop	B-Language
or	O
the	O
for	O
all-loop	O
or	O
something	O
else	O
may	O
not	O
be	O
clearly	O
described	O
in	O
the	O
compiler	B-Language
manual	O
.	O
</s>
<s>
If	O
the	O
result	O
were	O
false	O
the	O
for-loop	B-Language
'	O
s	O
execution	O
stops	O
short	O
.	O
</s>
<s>
In	O
computer	B-General_Concept
programming	I-General_Concept
,	O
a	O
loop	O
counter	O
is	O
a	O
control	B-General_Concept
variable	I-General_Concept
that	O
controls	O
the	O
iterations	B-Algorithm
of	O
a	O
loop	O
(	O
a	O
computer	B-General_Concept
programming	I-General_Concept
language	B-Language
construct	I-Language
)	O
.	O
</s>
<s>
Loop	O
counters	O
change	O
with	O
each	O
iteration	B-Algorithm
of	O
a	O
loop	O
,	O
providing	O
a	O
unique	O
value	O
for	O
each	O
individual	O
iteration	B-Algorithm
.	O
</s>
<s>
This	O
style	O
is	O
generally	O
agreed	O
to	O
have	O
originated	O
from	O
the	O
early	O
programming	O
of	O
Fortran	B-Application
,	O
where	O
these	O
variable	O
names	O
beginning	O
with	O
these	O
letters	O
were	O
implicitly	O
declared	O
as	O
having	O
an	O
integer	O
type	O
,	O
and	O
so	O
were	O
obvious	O
choices	O
for	B-Language
loop	I-Language
counters	O
that	O
were	O
only	O
temporarily	O
required	O
.	O
</s>
<s>
An	O
example	O
of	O
C	B-Language
code	O
involving	O
nested	O
for	B-Language
loops	I-Language
,	O
where	O
the	O
loop	O
counter	O
variables	O
are	O
i	O
and	O
j	O
:	O
</s>
<s>
For	B-Language
loops	I-Language
in	O
C	B-Language
can	O
also	O
be	O
used	O
to	O
print	O
the	O
reverse	O
of	O
a	O
word	O
.	O
</s>
<s>
This	O
C-style	O
for-loop	B-Language
is	O
commonly	O
the	O
source	O
of	O
an	O
infinite	B-Algorithm
loop	I-Algorithm
since	O
the	O
fundamental	O
steps	O
of	O
iteration	B-Algorithm
are	O
completely	O
in	O
the	O
control	O
of	O
the	O
programmer	O
.	O
</s>
<s>
In	O
fact	O
,	O
when	O
infinite	B-Algorithm
loops	I-Algorithm
are	O
intended	O
,	O
this	O
type	O
of	O
for-loop	B-Language
can	O
be	O
used	O
(	O
with	O
empty	O
expressions	O
)	O
,	O
such	O
as	O
:	O
</s>
<s>
This	O
style	O
is	O
used	O
instead	O
of	O
infinite	O
loops	O
to	O
avoid	O
a	O
type	O
conversion	O
warning	O
in	O
some	O
C/C	O
++	O
compilers	B-Language
.	O
</s>
<s>
Some	O
languages	O
may	O
also	O
provide	O
other	O
supporting	O
statements	O
,	O
which	O
when	O
present	O
can	O
alter	O
how	O
the	O
for-loop	B-Language
iteration	B-Algorithm
proceeds	O
.	O
</s>
<s>
Common	O
among	O
these	O
are	O
the	O
break	O
and	O
continue	O
statements	O
found	O
in	O
C	B-Language
and	O
its	O
derivatives	O
.	O
</s>
<s>
The	O
continue	O
statement	O
will	O
move	O
at	O
once	O
to	O
the	O
next	O
iteration	B-Algorithm
without	O
further	O
progress	O
through	O
the	O
loop	O
body	O
for	O
the	O
current	O
iteration	B-Algorithm
.	O
</s>
<s>
A	O
for	B-Language
statement	I-Language
also	O
terminates	O
when	O
a	O
break	O
,	O
goto	O
,	O
or	O
return	O
statement	O
within	O
the	O
statement	O
body	O
is	O
executed	O
.	O
</s>
<s>
Other	O
languages	O
may	O
have	O
similar	O
statements	O
or	O
otherwise	O
provide	O
means	O
to	O
alter	O
the	O
for-loop	B-Language
progress	O
;	O
for	O
example	O
in	O
FORTRAN	B-Application
95	O
:	O
</s>
<s>
Fortran	B-Application
95	O
,	O
for	O
example	O
:	O
</s>
<s>
Thus	O
,	O
when	O
"	O
trouble	O
"	O
is	O
detected	O
in	O
the	O
inner	O
loop	O
,	O
the	O
CYCLE	O
X1	O
(	O
not	O
X2	O
)	O
means	O
that	O
the	O
skip	O
will	O
be	O
to	O
the	O
next	O
iteration	B-Algorithm
for	O
I	O
,	O
not	O
J	O
.	O
</s>
<s>
The	O
compiler	B-Language
will	O
also	O
be	O
checking	O
that	O
each	O
END	O
DO	O
has	O
the	O
appropriate	O
label	O
for	O
its	O
position	O
:	O
this	O
is	O
not	O
just	O
a	O
documentation	O
aid	O
.	O
</s>
<s>
This	O
permits	O
a	O
compiler	B-Language
to	O
generate	O
code	O
that	O
leaves	O
any	O
value	O
in	O
the	O
loop	O
variable	O
,	O
or	O
perhaps	O
even	O
leaves	O
it	O
unchanged	O
because	O
the	O
loop	O
value	O
was	O
held	O
in	O
a	O
register	O
and	O
never	O
stored	O
to	O
memory	O
.	O
</s>
<s>
Actual	O
behaviour	O
may	O
even	O
vary	O
according	O
to	O
the	O
compiler	B-Language
's	O
optimization	O
settings	O
,	O
as	O
with	O
the	O
Honywell	O
Fortran66	O
compiler	B-Language
.	O
</s>
<s>
In	O
some	O
languages	O
(	O
not	O
C	B-Language
or	O
C++	B-Language
)	O
the	O
loop	O
variable	O
is	O
immutable	B-Application
within	O
the	O
scope	O
of	O
the	O
loop	O
body	O
,	O
with	O
any	O
attempt	O
to	O
modify	O
its	O
value	O
being	O
regarded	O
as	O
a	O
semantic	O
error	O
.	O
</s>
<s>
However	O
,	O
only	O
overt	O
changes	O
are	O
likely	O
to	O
be	O
detected	O
by	O
the	O
compiler	B-Language
.	O
</s>
<s>
Situations	O
where	O
the	O
address	O
of	O
the	O
loop	O
variable	O
is	O
passed	O
as	O
an	O
argument	O
to	O
a	O
subroutine	O
make	O
it	O
very	O
difficult	O
to	O
check	O
,	O
because	O
the	O
routine	O
's	O
behavior	O
is	O
in	O
general	O
unknowable	O
to	O
the	O
compiler	B-Language
.	O
</s>
<s>
Some	O
examples	O
in	O
the	O
style	O
of	O
Fortran	B-Application
:	O
</s>
<s>
A	O
common	O
approach	O
is	O
to	O
calculate	O
the	O
iteration	B-Algorithm
count	O
at	O
the	O
start	O
of	O
a	O
loop	O
(	O
with	O
careful	O
attention	O
to	O
overflow	O
as	O
in	O
in	O
sixteen-bit	O
integer	O
arithmetic	O
)	O
and	O
with	O
each	O
iteration	B-Algorithm
decrement	O
this	O
count	O
while	O
also	O
adjusting	O
the	O
value	O
of	O
:	O
double	O
counting	O
results	O
.	O
</s>
<s>
However	O
,	O
adjustments	O
to	O
the	O
value	O
of	O
within	O
the	O
loop	O
will	O
not	O
change	O
the	O
number	O
of	O
iterations	B-Algorithm
executed	O
.	O
</s>
<s>
Still	O
another	O
possibility	O
is	O
that	O
the	O
code	O
generated	O
may	O
employ	O
an	O
auxiliary	O
variable	O
as	O
the	O
loop	O
variable	O
,	O
possibly	O
held	O
in	O
a	O
machine	O
register	O
,	O
whose	O
value	O
may	O
or	O
may	O
not	O
be	O
copied	O
to	O
on	O
each	O
iteration	B-Algorithm
.	O
</s>
<s>
Just	O
as	O
the	O
index	O
variable	O
might	O
be	O
modified	O
within	O
a	O
for-loop	B-Language
,	O
so	O
also	O
may	O
its	O
bounds	O
and	O
direction	O
.	O
</s>
<s>
A	O
compiler	B-Language
may	O
prevent	O
such	O
attempts	O
,	O
they	O
may	O
have	O
no	O
effect	O
,	O
or	O
they	O
might	O
even	O
work	O
properly	O
-	O
though	O
many	O
would	O
declare	O
that	O
to	O
do	O
so	O
would	O
be	O
wrong	O
.	O
</s>
<s>
If	O
the	O
approach	O
to	O
compiling	B-Language
such	O
a	O
loop	O
was	O
to	O
be	O
the	O
evaluation	O
of	O
,	O
and	O
and	O
the	O
calculation	O
of	O
an	O
iteration	B-Algorithm
count	O
via	O
something	O
like	O
once	O
only	O
at	O
the	O
start	O
,	O
then	O
if	O
those	O
items	O
were	O
simple	O
variables	O
and	O
their	O
values	O
were	O
somehow	O
adjusted	O
during	O
the	O
iterations	B-Algorithm
,	O
this	O
would	O
have	O
no	O
effect	O
on	O
the	O
iteration	B-Algorithm
count	O
even	O
if	O
the	O
element	O
selected	O
for	O
division	O
by	O
changed	O
.	O
</s>
<s>
PL/I	B-Language
and	O
Algol	B-Language
68	I-Language
,	O
allows	O
loops	O
in	O
which	O
the	O
loop	O
variable	O
is	O
iterated	B-Algorithm
over	O
a	O
list	O
of	O
ranges	O
of	O
values	O
instead	O
of	O
a	O
single	O
range	O
.	O
</s>
<s>
The	O
following	O
PL/I	B-Language
example	O
will	O
execute	O
the	O
loop	O
with	O
six	O
values	O
of	O
i	O
:	O
1	O
,	O
7	O
,	O
12	O
,	O
13	O
,	O
14	O
,	O
15	O
:	O
</s>
<s>
A	O
for-loop	B-Language
is	O
generally	O
equivalent	O
to	O
a	O
while-loop	O
:	O
</s>
<s>
Given	O
an	O
action	O
that	O
must	O
be	O
repeated	O
,	O
for	O
instance	O
,	O
five	O
times	O
,	O
different	O
languages	O
 '	O
for-loops	B-Language
will	O
be	O
written	O
differently	O
.	O
</s>
<s>
The	O
syntax	B-Application
for	O
a	O
three-expression	O
for-loop	B-Language
is	O
nearly	O
identical	O
in	O
all	O
languages	O
that	O
have	O
it	O
,	O
after	O
accounting	O
for	O
different	O
styles	O
of	O
block	O
termination	O
and	O
so	O
on	O
.	O
</s>
<s>
Fortran	B-Application
's	O
equivalent	O
of	O
the	O
loop	O
is	O
the	O
loop	O
,	O
</s>
<s>
The	O
syntax	B-Application
of	O
Fortran	B-Application
's	O
loop	O
is	O
:	O
</s>
<s>
The	O
following	O
two	O
examples	O
behave	O
equivalently	O
to	O
the	O
three	O
argument	O
for-loop	B-Language
in	O
other	O
languages	O
,	O
</s>
<s>
initializing	O
the	O
counter	O
variable	O
to	O
1	O
,	O
incrementing	O
by	O
1	O
each	O
iteration	B-Algorithm
of	O
the	O
loop	O
and	O
stopping	O
at	O
five	O
(	O
inclusive	O
)	O
.	O
</s>
<s>
In	O
Fortran	B-Application
77	O
(	O
or	O
later	O
)	O
,	O
this	O
may	O
also	O
be	O
written	O
as	O
:	O
</s>
<s>
Spaces	O
are	O
irrelevant	O
in	O
fixed-form	O
Fortran	B-Application
statements	O
,	O
thus	O
is	O
the	O
same	O
as	O
.	O
</s>
<s>
In	O
the	O
modern	O
free-form	O
Fortran	B-Application
style	O
,	O
blanks	O
are	O
significant	O
.	O
</s>
<s>
In	O
Fortran	B-Application
90	O
,	O
the	O
may	O
be	O
avoided	O
by	O
using	O
an	O
statement	O
.	O
</s>
<s>
ALGOL	B-Language
58	I-Language
introduced	O
the	O
statement	O
,	O
using	O
the	O
form	O
as	O
Superplan	B-Language
:	O
</s>
<s>
COBOL	B-Application
was	O
formalized	O
in	O
late	O
1959	O
and	O
has	O
had	O
many	O
elaborations	O
.	O
</s>
<s>
Originally	O
all	O
loops	O
had	O
to	O
be	O
out-of-line	O
with	O
the	O
iterated	B-Algorithm
code	O
occupying	O
a	O
separate	O
paragraph	O
.	O
</s>
<s>
Ignoring	O
the	O
need	O
for	O
declaring	O
and	O
initialising	O
variables	O
,	O
the	O
COBOL	B-Application
equivalent	O
of	O
a	O
for-loop	B-Language
would	O
be	O
.	O
</s>
<s>
In	O
the	O
1980s	O
the	O
addition	O
of	O
in-line	O
loops	O
and	O
"	O
structured	O
"	O
statements	O
such	O
as	O
END-PERFORM	O
resulted	O
in	O
a	O
for-loop	B-Language
with	O
a	O
more	O
familiar	O
structure	O
.	O
</s>
<s>
Notice	O
that	O
the	O
end-loop	O
marker	O
specifies	O
the	O
name	O
of	O
the	O
index	O
variable	O
,	O
which	O
must	O
correspond	O
to	O
the	O
name	O
of	O
the	O
index	O
variable	O
in	O
the	O
start	O
of	O
the	O
for-loop	B-Language
.	O
</s>
<s>
Some	O
languages	O
(	O
PL/I	B-Language
,	O
FORTRAN	B-Application
95	O
and	O
later	O
)	O
allow	O
a	O
statement	O
label	O
on	O
the	O
start	O
of	O
a	O
for-loop	B-Language
that	O
can	O
be	O
matched	O
by	O
the	O
compiler	B-Language
against	O
the	O
same	O
text	O
on	O
the	O
corresponding	O
end-loop	O
statement	O
.	O
</s>
<s>
Fortran	B-Application
also	O
allows	O
the	O
and	O
statements	O
to	O
name	O
this	O
text	O
;	O
in	O
a	O
nest	O
of	O
loops	O
this	O
makes	O
clear	O
which	O
loop	O
is	O
intended	O
.	O
</s>
<s>
Some	O
PL/I	B-Language
dialects	O
include	O
the	O
statement	O
to	O
terminate	O
the	O
current	O
loop	O
iteration	B-Algorithm
and	O
begin	O
the	O
next	O
.	O
</s>
<s>
ALGOL	B-Language
68	I-Language
has	O
what	O
was	O
considered	O
the	O
universal	O
loop	O
,	O
the	O
full	O
syntax	B-Application
is	O
:	O
</s>
<s>
Further	O
,	O
the	O
single	O
iteration	B-Algorithm
range	O
could	O
be	O
replaced	O
by	O
a	O
list	O
of	O
such	O
ranges	O
.	O
</s>
<s>
only	O
the	O
portion	O
was	O
compulsory	O
,	O
in	O
which	O
case	O
the	O
loop	O
will	O
iterate	B-Algorithm
indefinitely	O
.	O
</s>
<s>
thus	O
the	O
clause	O
,	O
will	O
iterate	B-Algorithm
exactly	O
100	O
times	O
.	O
</s>
<s>
Subsequent	O
extensions	O
to	O
the	O
standard	O
Algol68	B-Language
allowed	O
the	O
syntactic	O
element	O
to	O
be	O
replaced	O
with	O
and	O
to	O
achieve	O
a	O
small	O
optimization	O
.	O
</s>
<s>
The	O
same	O
compilers	B-Language
also	O
incorporated	O
:	O
</s>
<s>
for	O
working	O
on	O
arrays	O
in	B-General_Concept
parallel	I-General_Concept
.	O
</s>
<s>
The	O
numeric-range	O
for-loop	B-Language
varies	O
somewhat	O
more	O
.	O
</s>
<s>
The	O
ISO/IEC	B-Language
9899:1999	I-Language
publication	O
(	O
commonly	O
known	O
as	O
C99	B-Language
)	O
also	O
allows	O
initial	O
declarations	O
in	O
loops	O
.	O
</s>
<s>
All	O
the	O
three	O
sections	O
in	O
the	O
for	B-Language
loop	I-Language
are	O
optional	O
,	O
with	O
an	O
empty	O
condition	O
equivalent	O
to	O
true	O
.	O
</s>
<s>
Contrary	O
to	O
other	O
languages	O
,	O
in	O
Smalltalk	B-Application
a	O
for-loop	B-Language
is	O
not	O
a	O
language	B-Language
construct	I-Language
but	O
defined	O
in	O
the	O
class	O
Number	O
as	O
a	O
method	O
with	O
two	O
parameters	O
,	O
the	O
end	O
value	O
and	O
a	O
closure	B-Language
,	O
using	O
self	O
as	O
start	O
value	O
.	O
</s>
<s>
Maple	O
has	O
two	O
forms	O
of	O
for-loop	B-Language
,	O
one	O
for	O
iterating	O
of	O
a	O
range	O
of	O
values	O
,	O
and	O
the	O
other	O
for	O
iterating	O
over	O
the	O
contents	O
of	O
a	O
container	O
.	O
</s>
<s>
The	O
remaining	O
parts	O
(	O
from	O
f	O
,	O
by	O
b	B-Language
,	O
to	O
t	O
,	O
while	O
w	O
)	O
can	O
appear	O
in	O
any	O
order	O
.	O
</s>
<s>
The	O
in	O
c	B-Language
clause	O
specifies	O
the	O
container	O
,	O
which	O
may	O
be	O
a	O
list	O
,	O
set	O
,	O
sum	O
,	O
product	O
,	O
unevaluated	O
function	O
,	O
array	O
,	O
or	O
an	O
object	O
implementing	O
an	O
iterator	O
.	O
</s>
<s>
A	O
for-loop	B-Language
may	O
be	O
terminated	O
by	O
od	O
,	O
end	O
,	O
or	O
end	O
do	O
.	O
</s>
<s>
In	O
Maxima	B-Language
CAS	I-Language
one	O
can	O
use	O
also	O
non	O
integer	O
values	O
:	O
</s>
<s>
The	O
for-loop	B-Language
,	O
written	O
as	O
initialises	O
an	O
internal	O
variable	O
,	O
executes	O
the	O
body	O
as	O
long	O
as	O
the	O
internal	O
variable	O
is	O
not	O
more	O
than	O
limit	O
(	O
or	O
not	O
less	O
,	O
if	O
increment	O
is	O
negative	O
)	O
and	O
,	O
at	O
the	O
end	O
of	O
each	O
iteration	B-Algorithm
,	O
increments	O
the	O
internal	O
variable	O
.	O
</s>
<s>
Before	O
each	O
iteration	B-Algorithm
,	O
the	O
value	O
of	O
the	O
internal	O
variable	O
is	O
pushed	O
onto	O
the	O
stack	O
.	O
</s>
<s>
(	O
Note	O
that	O
"	O
there	B-Architecture
's	I-Architecture
more	I-Architecture
than	I-Architecture
one	I-Architecture
way	I-Architecture
to	I-Architecture
do	I-Architecture
it	I-Architecture
"	O
is	O
a	O
Perl	O
programming	O
motto	O
.	O
)	O
</s>
<s>
Note	O
that	O
an	O
empty	O
loop	O
(	O
i.e.	O
,	O
one	O
with	O
no	O
commands	O
between	O
and	O
)	O
is	O
a	O
syntax	B-Application
error	O
.	O
</s>
<s>
If	O
the	O
above	O
loops	O
contained	O
only	O
comments	O
,	O
execution	O
would	O
result	O
in	O
the	O
message	O
"	O
syntax	B-Application
error	O
near	O
unexpected	O
token	O
'	O
done	O
 '	O
"	O
.	O
</s>
<s>
Note	O
that	O
in	O
the	O
original	O
Oberon	B-Language
language	O
the	O
for-loop	B-Language
was	O
omitted	O
in	O
favor	O
of	O
the	O
more	O
general	O
Oberon	B-Language
loop	O
construct	O
.	O
</s>
<s>
The	O
for-loop	B-Language
was	O
reintroduced	O
in	O
Oberon-2	O
.	O
</s>
<s>
Python	B-Language
does	O
not	O
contain	O
the	O
classical	O
for	B-Language
loop	I-Language
,	O
rather	O
a	O
foreach	O
loop	O
is	O
used	O
to	O
iterate	B-Algorithm
over	O
the	O
output	O
of	O
the	O
built-in	O
range( )	O
function	O
which	O
returns	O
an	O
iterable	O
sequence	O
of	O
integers.Using	O
range(6 )	O
would	O
run	O
the	O
loop	O
from	O
0	O
to	O
5	O
.	O
</s>
<s>
You	O
can	O
also	O
iterate	B-Algorithm
through	O
a	O
list	O
of	O
items	O
,	O
similar	O
to	O
what	O
you	O
can	O
do	O
with	O
arrays	O
in	O
other	O
languages	O
:	O
</s>
<s>
Unlike	O
other	O
languages	O
,	O
AppleScript	O
does	O
not	O
currently	O
have	O
any	O
command	O
to	O
continue	O
to	O
the	O
next	O
iteration	B-Algorithm
of	O
a	O
loop	O
.	O
</s>
<s>
For-loops	B-Language
can	O
also	O
loop	O
through	O
a	O
table	O
using	O
to	O
iterate	B-Algorithm
numerically	O
through	O
arrays	O
and	O
to	O
iterate	B-Algorithm
randomly	O
through	O
dictionaries	O
.	O
</s>
<s>
Generic	O
for-loop	B-Language
making	O
use	O
of	O
closures	B-Language
:	O
</s>
<s>
The	O
above	O
example	O
is	O
only	O
available	O
in	O
the	O
dialect	O
of	O
CFML	B-Language
used	O
by	O
Lucee	B-Language
and	O
Railo	B-Language
.	O
</s>
<s>
For	O
the	O
extended	O
for-loop	B-Language
,	O
see	O
.	O
</s>
<s>
JavaScript	O
supports	O
C-style	O
"	O
three-expression	O
"	O
loops	O
.	O
</s>
<s>
Alternatively	O
,	O
it	O
is	O
possible	O
to	O
iterate	B-Algorithm
over	O
all	O
keys	O
of	O
an	O
array	O
.	O
</s>
<s>
Ruby	B-Language
has	O
several	O
possible	O
syntaxes	B-Application
,	O
including	O
the	O
above	O
samples	O
.	O
</s>
<s>
See	O
expression	O
syntax	B-Application
.	O
</s>
<s>
Nim	B-Application
has	O
a	O
foreach-type	O
loop	O
and	O
various	O
operations	O
for	O
creating	O
iterators	O
.	O
</s>
