Elif Store True Property
If the "elif" statement tested true, then store "tested_true" in the "if" stack. 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 =
elif test:
- expression state at time t = "end_expr"
- Return Value at time t = True
then Control Map at time (t + 1) = result of storing (pair ("if", True)) at key: j in map: (Control Map at time t)
If the "elif" statement tested True, then remember this result, so that LW Python doesn't run any other "elif" or "else" blocks that follow the current "elif" block. For example,
if the following are true:
- the line at time 22 = 3
- the tab at time 22 = 0
- statement at line 3, tab 0 =
elif __eq__(3, 3):
- expression state at time 22 = "end_expr"
- Return Value at time 22 = True
- "if" map at time 22 = [ pair (0, "tested_false"), [ ] ]
then "if" map at time (22 + 1) = result of storing "tested_true" at key: 0 in map: ("if" map at time 22)
Try stepping through the simulator to see LW Python add key 0 and value "tested_true" to the "if" stack.
Code Editor
LW Python State
Current Line | 1 | Current Tab | 0 | Time | 0 |
LW Python Simulator
Comments
Please log in to add comments