Up until now, all variables are said to be global. This means that all variables are visible and accessible from any line in a pseudocode algorithm. A local variable, however, is local to a subroutine. This means that if “x” is a variable local to subroutine “s1”, then only code in “s1” can see this variable “x”.
Local variables, by limiting the scope to the containing subroutine, makes it possible to use the same local variable name in different subroutines. This is because the local variable “x” of a subroutine, say “s1”, has nothing to do with the local variable “x” of a different subroutine, say “s2”.
Even more interestingly, local variables have the same lifespan as the “retline#” column of a subroutine. In other words, local variables are allocated on a per-invocation basis.
Local variables do not have any specific initial value. As a result, a trace should always use “?” as the initial value of a local variable when it is created.
The invocation of a subroutine with local variables should allocate a column per local variable. Likewise the returning of a subroutine with local variables should deallocate all local variables when the “retline#” column is deallocated.