Looping in the Coding Environment

Summary:

As a learner, I would like to create programs in the Inclusive Coding Environment that allow me to repeat sequences.

Figma Designs




Details:

  • 'Loop' is available in the Actions Panel
  • Add a Loop feature
    • Inserts start loop, end loop, loop counter and the ability to add contents to the loop
    • The loop may specify a fixed count of iterations, or "forever"
    • The loop is executed the number of time specified in the loop counter
    • The loop is highlighted and counts down to 0 during execution
  • The control panel for the 'Start Loop' and 'End Loop' tiles have the following operations:
    • Move Loop
      • Contents of the loop move with it (see below for an example)
    • Delete Loop
      • Dialog to determine whether the contents of the loop are also deleted
  • Loops may be nested

Notes and Examples:

Movement of Loops

When a loop is selected to be moved, the entire loop moves as if it is a single tile. It will move in or out of an enclosing loop when directed to.

start-loop-a, forward, end-loop-a, start-loop-b, end-loop-b
Move start-loop-a next
start-loop-b, start-loop-a, forward, end-loop-a, end-loop-b
Move start-loop-a next
start-loop-b, end-loop-b, start-loop-a, forward, end-loop-a

Movement of tiles in relation to loops

start-loop-a, forward, end-loop-a, start-loop-b, end-loop-b
Move forward next
start-loop-a, end-loop-a, forward, start-loop-b, end-loop-b
Move forward next
start-loop-a, end-loop-a, start-loop-b, forward, end-loop-b

Loop Counter

  • Maximum number of loop iterations is 3 digits: 0 - 999
  • Default is 1
  • If the counter is empty, treat it as 0
  • Counter only allows digits to be entered
  • Loop counts cannot be changed while a program is running
  • During execution, counter remains at 0 after the loop has completed and resets to the original value when the program stops
  • The loop counter ‘Stop’ button breaks out of the loop and continues after the loop (maybe it should be “escape”?)