Skip Else Tab Property

If the current statement is an "else" statement, and the corresponding "if" statement tested True, then tab remains the same. 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 = else:
  • value at j in map (Control Map at time t) = pair ("if", True)

then the tab at time (t + 1) = j

If the "if" statement previously tested True, then the "else" statement body will be skipped. The tab number stays the same. Since the tab number of the "else" body is greater than the current tab number, the lines in the "else" body are not executed.

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 = else:
  • value at 0 in map (Control Map at time 13) = pair ("if", True)

then the tab at time (13 + 1) = 0

The "Control" map indicates that there was an "if" test at tab 0 which tested true. Try stepping through the simulator to see the tab number remain the same.

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments