In Figure 8.6 of the book it mentions that all labels within a function body should be prefixed with the name of the function plus a dollar sign (i.e. label '
loop' in function '
multiply' should be named '
multiply$loop').
My question is, how can we reliably determine when a function body has completed?
Functions can have multiple '
return' statements within them, so I cannot rely on that.
The only thing I can think of is that there is no '
global' scope in the Jack language - i.e. all statements (apart from the bootstrap code) have to live within one function or another. If that is indeed the case then there is no issue.
Can anyone verify this for me please?
Cheers.
Anjum.