Break Statement Property

If there is a break statement at the current line and tab at time t, then at time t + 1, update the break state to "breaking." More formally,

if the following are true:
  • the line at time t = i
  • the tab at time t = j
  • statement at line i, tab j = break

then "break" state at (t + 1) = "breaking"

When LW Python encounters a break statement, it will set the break state to "breaking," which signals LW Python to decrease the tab number until it finds a "while" statement.

For example, if the following are true:

  • the line at time 88 = 6
  • the tab at time 88 = 2
  • statement at line 6, tab 2 = break

then "break" state at (88 + 1) = "breaking"

Try stepping through the simulator to see the "Break State" change to "breaking."

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments