4 Program Control
Macro | Description | Page | |
---|---|---|---|
while | Repeatedly executes a body until a test expression is false. | 386 | |
until | Repeatedly executes a body until a test expression is true. | 386 | |
for | Performs general iteration over a body, updating bindings and performing end tests on each iteration. | 387 |
The following example uses tail recursion to compute the name of the root volume on which a given file system object is stored.
define method root-volume-name (f :: <file-or-directory>) if ( root-volume?(f) ) f.name else root-volume-name(f.container) end if; end method;The example above can execute with constant stack size, regardless of how deeply nested the file system hierarchy may be.
Generated with Harlequin WebMaker