Record Variables

While C data structures are not supported, aggregate record variables are. A record variable is actually a delimited list of “name=value” pairs. Record variables are used in the same way that a “struct” would be used in C.

Record variables are returned by some internal macro functions because it is a convenient way to return multiple values.

Record fields are referred to with the dot (.) operator using a <recordvar>.<fieldname> format.

For example, this reads the name of a symbol’s file location from a symbol lookup record variable.

Filename = slr.file  // get file field of slr
LineNumber = slr.lnFirst  // get lnFirst field of slr

 

You assign values to a record variable in a similar way:

userinfo.name = myname; // set “name” field of userinfo

 

You can initialize an empty record by assigning nil to it:

userinfo = nil // make a new empty record
userinfo.name = “Jeff” // begin adding fields