Iteration: Difference between revisions

From Computer Science Wiki
No edit summary
Line 26: Line 26:
<iframe width="560" height="315" src="https://www.youtube.com/embed/l26oaHV7D40" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/l26oaHV7D40" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</html>
</html>
== Example one ==
<syntaxhighlight lang="python">
for i in range (0,100):
  print(i)
# output will be:
0
1
2
3
4
5
...
99
</syntaxhighlight>


== Standards ==  
== Standards ==  

Revision as of 13:14, 18 June 2019

This is a basic concept in computer science

In computer programming, iteration is a sequence of instructions that is continually repeated. You can think of iteration as a loop, but please use the word "iteration" or "iterate". As a computer scientist, we use specialized vocabulary to communicate with other computer scientists. -

There are different types of iterations:

  1. iterate until a certain condition is reached
  2. iterate a certain number of times
  3. iterate through elements in a list or array

When we iterate our programming language tracks what step of the iteration is currently being executed. For example: if we are iterating 100 times (from zero to one hundred, incrementing by one each at each step), our programming language will keep track of which iteration we are cycling through.

Iteration is a fundamental programming idea that is commonly used in writing programs.

Video one[edit]

This is one of the better videos I've seen on loops. Content gratefully used with permission[1].


Video two[edit]

Example one[edit]

for i in range (0,100):
   print(i)

# output will be: 

0 
1
2
3
4
5
...
99

Standards[edit]

  • Construct algorithms using loops, branching.

References[edit]