Skip Elif Line Property

If the "if" statement tested true, and LW Python is currently on a "elif" statement, then increment the line number by 1. 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 = elif test:
  • value at j in map (Control Map at time t) = pair ("if", True)
  • expression state at time t = "not_expr"

then the line at time (t + 1) = i + 1

If the "if" statement tested true, then the "elif" statement and block will be skipped. As part of this, the line number will increment by 1. How do we know the "if" test was true? Because the "Control" map at the current tab number is "if":True. For example, if the following are true:

  • the line at time 13 = 3
  • the tab at time 13 = 0
  • statement at line 3, tab 0 = elif __eq__(3, 3):
  • value at 0 in map (Control Map at time 13) = pair ("if", True)
  • expression state at time 13 = "not_expr"

then the line at time (13 + 1) = 3 + 1

Try stepping through the simulator to see LW Python increment "Line" by 1.

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments