Assign Constructor Initial Expression 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 the expression at time (t + 1) = Python constructor with name: name and arguments: args

The "Expression" is set to the expression, which is an object constructor. 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 the expression at time (8 + 1) = Person("John", "Smith", 25)

Try stepping through the simulator to see LW Python set "Expression" to the constructor.

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments