Original Author Paul Laughton, 2011
Page 50
De Re BASIC!
Bundle.contain <pointer_nexp>, <key_sexp> , <contains_nvar>
If the key specified in the key string expression is contained in the bundle's keys then the "contains"
numeric variable will be returned with a non-zero value. The value returned will be zero if the key is not
in the bundle. If the bundle does not exist, a new one may be created.
Bundle.type <pointer_nexp>, <key_sexp>, <type_svar>
Returns the value type (string or numeric) of the specified key in the specified string variable. The
<type_svar> will contain an uppercase "N" if the type is numeric. The <type_svar> will contain an
uppercase "S" if the type is a string. If the bundle does not exist or does not contain the requested key,
the command generates a run-time error.
Example:
BUNDLE.TYPE bptr, "age", type$
PRINT type$ % will print N
Bundle.remove <pointer_nexp>, <key_sexp>
Removes the key named by the string expression <key_sexp>, along with the associated value, from the
bundle pointed to by the numeric expression <pointer_nexp>. If the bundle does not contain the key,
nothing happens. If the bundle does not exist, a new one may be created.
Bundle.clear <pointer_nexp>
The bundle pointed to by <pointer_nexp> will be cleared of all tags. It will become an empty bundle. If
the bundle does not exist, a new one may be created.
Stacks
Stacks are like a magazine for a gun.
The last bullet into the magazine is the first bullet out of the magazine. This is also what is true about
stacks. The last object placed into the stack is the first object out of the stack. This is called LIFO (Last In
First Out).
An example of the use of a stack is the BASIC! Gosub command. When a Gosub command is executed
the line number to return to is "pushed" onto a stack. When a return is executed the return line number
is "popped" off of the stack. This methodology allows Gosubs to be nested to any level. Any return
statement will always return to the line after the last Gosub executed.
A running example of Stacks can be found in the Sample Program file, f29_stack.bas.