Record Variables

While data structures such as classes are not supported, Source Insight supports record variables. A record variable is actually a delimited list of "name=value" pairs. There is no predefined order of fields in a record variable, and they don’t have to be declared before using them.

Record variables are used in the same way that a "struct" would be used in C. 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

 

You can create your own record variables whenever you want this way.

Record variables are a convenient way to return multiple values from a function. Several built-in functions return record variables.

An example of a standard record is the Selection Record. See: Selection Record .