If Statement State Property
If there is an "if" statement at the current line and tab, then the expression state is updated to "begin_expr." 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 = "not_expr"
then expression state at time (t + 1) = "begin_expr"
When Python sees an "if" statement, Python first evaluates the test by setting the expression state to "begin_expr."
For example,
if the following are true:
- the line at time 0 = 0
- the tab at time 0 = 0
- statement at line 0, tab 0 =
if __eq__(3, 3):
- expression state at time 0 = "not_expr"
then expression state at time (0 + 1) = "begin_expr"
Try stepping through the simulator to see the "Expression State" change to "begin_expr."
Code Editor
LW Python State
Current Line | 1 | Current Tab | 0 | Time | 0 |
LW Python Simulator
Comments
Please log in to add comments