Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Iteration
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Implementations === [[Control flow#Loops |Loops]] constitute the most common language constructs for performing iterations. The following [[pseudocode]] "iterates" three times the line of code between begin & end through a ''for loop'', and uses the values of ''i'' as increments. <syntaxhighlight lang="pascal"> a := 0 for i := 1 to 3 do { loop three times } begin a := a + i; { add the current value of i to a } end; print(a); { the number 6 is printed (0 + 1; 1 + 2; 3 + 3) } </syntaxhighlight> It is permissible, and often necessary, to use values from other parts of the program outside the bracketed block of statements, to perform the desired function. [[Iterators]] constitute alternative language constructs to loops, which ensure consistent iterations over specific data structures. They can eventually save time and effort in later coding attempts. In particular, an iterator allows one to repeat the same kind of operation at each node of such a data structure, often in some pre-defined order. [[Iteratees]] are purely functional language constructs, which accept or reject data during the iterations.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)