Elif Property

If the "if" statement tested False and there is an "elif" statement in the current line and tab, then set the "Expression" to the "elif" test expression. 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:
  • value at j in map (Control Map at time t) = pair ("if", False)
  • expression state at time t = "not_expr"

then the expression at time (t + 1) = test

If the "if" statement tested False, then begin evaluating the "elif" statement test condition.

For example, if the following are true:

  • the line at time 12 = 3
  • the tab at time 12 = 0
  • statement at line 3, tab 0 = elif __eq__(3, 3):
  • expression state at time 12 = "not_expr"
  • value at 0 in map (Control Map at time 12) = pair ("if", False)

then the expression at time (12 + 1) = __eq__(3, 3)

Try stepping through the simulator to see LW Python set the "Expression" to "3 == 3"

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments