Elif State Property

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

then expression state at time (t + 1) = "begin_expr"

If the "if" statement tested false, then Python skips the "if" block and evaluates the "elif" statement test to see if the "elif" block should be entered.

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):
  • value at 0 in map (Control Map at time 12) = pair ("if", False)
  • expression state at time 12 = "not_expr"

then expression state at time (12 + 1) = "begin_expr"

The "Control" map indicates that the "if" test at tab 0 was false. Try stepping through the simulator to see LW Python set the "Expression State" to "begin_expr."

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments