Control Flow & Semantics

Loop Execution
Closure Capture

Watch a for loop execute step by step. The loop invariant sum = 0 + 1 + ... + (i-1) is maintained at each iteration.

n = 5

  
Press Step or Auto to begin.

Watch a closure capture a shared environment cell. Two functions created in the same scope share the same variable n.


  
Press Step to begin.