Difference between revisions of "W1153 Repeat-While Loop"
From Coder Merlin
Line 20: | Line 20: | ||
{{ResponsiveImage|[[File:Repeat-While Loop Flowchart.png]]}} | {{ResponsiveImage|[[File:Repeat-While Loop Flowchart.png]]}} | ||
== | == Assembly Language == | ||
Let's consider how the above construct is implemented in assembly language: | |||
{{ResponsiveImage|[[File:Repeat-While Loop Assembly.png]]}} | |||
== Topic Headers == | == Topic Headers == | ||
== Key Concepts == | == Key Concepts == | ||
== Exercises == | == Exercises == | ||
== References == | == References == |
Revision as of 18:09, 12 January 2020
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
Prerequisites[edit]
Repeat-While Loop[edit]
A repeat-while loop (which is also sometimes called a do-while loop):
- Executes the statements within the body of the loop
- Tests a condition
- If the condition is true, the statements within the body of the loop are again executed
- If the condition is false, execution continues with the statements after the body of the loop
Observe
Observe, Ponder, and Journal: Section 1
- Compare this behavior to that of the while loop. What are the similarities? What are the differences?
- What are the minimum number of times that this loop will execute?
- What is the purpose of the Jump instruction after the consequent?
Flowchart[edit]
Assembly Language[edit]
Let's consider how the above construct is implemented in assembly language: