If Test False Tab Property

If the "if" statement test evaluated to False at time t, then the tab number at time t + 1 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 = if test:
  • expression state at time t = "end_expr"
  • Return Value at time t = False

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

If the "if" statement test is False, then Python will skip the "if" body. The tab number will not change. Statements in the "if" body are in the tab number that is 1 more than the "if" statement tab number, so the statements will be skipped.

For example, if the following are true:

  • the line at time 11 = 1
  • the tab at time 11 = 0
  • statement at line 1, tab 0 = if __eq__(1, 3):
  • expression state at time 11 = "end_expr"
  • Return Value at time 11 = False

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

Try stepping through the simulator to see the tab number stay the same as the line number increments by 1.

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments