Keeping track of Variables

Important terms

Scope of a variable

Lifetime of a Variable

<aside> 💡 Hole in Scope → Variable is alive but not in scope.

</aside>

Memory Stack


  1. call factorial(3)

Untitled

  1. factorial(3) calls factorial(2)

Untitled


Memory with 2 activation records.

Memory with 2 activation records.


Passing arguments to functions