How are assignments and references different in Lasso 9 than in Lasso 8?

An example showing how the creation of assignments and references differs between Lasso 9 and Lasso 8.

Why

Here’s why you might do this:

  • You’re storing objects in a map and you want to retrieve them using the syntax var(‘varname’) instead of always having to type $myMapName->Find(‘myMapKey’).

Discussion

Every variable in Lasso is a named reference to an object. The referenced object could be a string, integer, array, map, or any other data type. Usually, each object is only referenced by one variable.

In Lasso 8 (but NOT in Lasso 9) the [Reference] tag (@ symbol) allows a reference to data to be stored in a variable rather than a copy of the referenced data.

For example: [variable: ‘VariableOne’ = @($VariableTwo)] stores a reference to VariableTwo in VariableOne. Now, both variables refer to the same object and changes made to one are reflected in the other.

However, the [Reference] tag does not work the same way in Lasso 9. To get the same functionality you must use the [String->Replace] tag.

See more examples at https://lassosoft.wiki.zoho.com/What-Has-Changed.html#assignment-and-references.

The Lasso 8 Way:

Lasso 8 way

 

The Lasso 9 Way:

Lasso 9 way-1
Lasso 9 way-2