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]]}}


== Introduction ==
== 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
Infinite Loop 1

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
ObserveObserveIcon.png
Observe, Ponder, and Journal: Section 1
  1. Compare this behavior to that of the while loop. What are the similarities? What are the differences?
  2. What are the minimum number of times that this loop will execute?
  3. What is the purpose of the Jump instruction after the consequent?

Flowchart[edit]

   Repeat-While Loop Flowchart.png

Assembly Language[edit]

Let's consider how the above construct is implemented in assembly language:

   Repeat-While Loop Assembly.png

Topic Headers[edit]

Key Concepts[edit]

Exercises[edit]

References[edit]