While Test Property
If there is a "while" statement at the current line and tab, and the expression state is "not_expr" at time t, then at time t + 1, the expression is updated to the test condition. 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 = "while" statement with condition (function call with name: name and arguments: args)
- expression state at time t = "not_expr"
then the expression at time (t + 1) = function call with name: name and arguments: args
When Python sees an "while" statement, Python first evaluates the test.
For example,
if the following are true:
- the line at time 1 = 2
- the tab at time 1 = 0
- statement at line 2, tab 0 =
while __lt__(a, 2):
- expression state at time 1 = "not_expr"
then the expression at time (1 + 1) = __lt__(a, 2)
Try stepping through the simulator to see "Expression" set to "a < 2."
Code Editor
LW Python State
Current Line | 1 | Current Tab | 0 | Time | 0 |
LW Python Simulator
Comments
Please log in to add comments