Assign Constructor Initial State Property

When LW Python sees an assignment statement, it first evaluates the expression on the right side of the "=." 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 = assign statement with target x and expression (Python constructor with name: name and arguments: args)
  • expression state at time t = "not_expr"

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

The "Expression State" is set to "begin_expr", which kicks off expression evaluation. For example, if the following are true:
  • the line at time 8 = 8
  • the tab at time 8 = 0
  • statement at line 8, tab 0 = p = Person("John", "Smith", 25)
  • expression state at time 8 = "not_expr"

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

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