Saturday, March 11, 2023

🆕 _MAPSET and _MAPGET

 From Wikipedia:

A name–value pair, also called an attribute–value pair, key–value pair, or field–value pair, is a fundamental data representation in computing systems and applications. Designers often desire an open-ended data structure that allows for future extension without modifying existing code or data. In such situations, all or part of the data model may be expressed as a collection of 2-tuples in the form <attribute name, value> with each element being an attribute–value pair. Depending on the particular application and the implementation chosen by programmers, attribute names may or may not be unique.


BASIC Anywhere Machine provides a global "MAP" object for holding key-value pairs W. Each key is a unique string value to which is related some value (numeric or string) that can be repeated for other keys.

_MAPSET

Description:

The _MAPSET statement stores the value (a number or a string which may be the result of an expression) for the provided key (which may be the result of an expression.)

Syntax

_MAPSET( strExprKey, exprValue )

  • strExprKey
    • a string, which may be a literal value, a constant, a variable, or an expression of whatever complexity
  • exprValue
    • a number or a string, which may be a literal value, a constant, a variable, or an expression of whatever complexity


_MAPGET

Description:

The _MAPGET function retrieves the value for the provided key (which may be an expression resulting in a key.)

Syntax

_MAPGET( strExprKey )

  • returns: the value associated with the key (numeric or string)
    • however, if there is no matching key, then the return value is an empty string (i.e. "")



No comments:

Post a Comment

đź–Ą Fan Dance

This is a port and mod of a SpecBAS program by ZXDunny. Run the program View the source code And, a "less is more?" version: Run t...