If Test False Line Property
If the "if" statement test evaluated to False at time t, then the line number at time t + 1 is the current line number + 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 =
if test:
- expression state at time t = "end_expr"
- Return Value at time t = False
then the line at time (t + 1) = i + 1
If the "if" statement test is False, then Python will skip the "if" body. The line number will be incremented by 1 (but the tab will remain the same).
For example,
if the following are true:
- the line at time 10 = 1
- the tab at time 11 = 0
- statement at line 1, tab 0 =
if __eq__(1, 3):
- expression state at time 10 = "end_expr"
- Return Value at time 11 = False
then the line at time (10 + 1) = 1 + 1
Try stepping through the simulator to see line number increment by 1.
Code Editor
LW Python State
Current Line | 1 | Current Tab | 0 | Time | 0 |
LW Python Simulator
Comments
Please log in to add comments