Data Pair Structures in SCL
Data pairs allow you to give values names. When you create a data structure as "pairs" you
then specify the values as key/value pairs in the "set" section. Then you can refer to
those values using the usual data.MyPairs. notation.
To change a data pair value, use "var" command to assign the new value.
See the example below.
See the example below.
Of course, as a data structure, you can also assign data pairs to a level using "into".
You can read more about levels here.
Example:
create data from pairs as MyPairs
set
x=1 y=2 z="hi there"
end
create routine as Start
log(data.MyPairs.x) // print 1
log(data.MyPairs.y) // print 2
var data.MyPairs.y=3
log(data.MyPairs.y) // print 3
update data MyPairs reset
log(data.MyPairs.y) // print 2
end
set
x=1 y=2 z="hi there"
end
create routine as Start
log(data.MyPairs.x) // print 1
log(data.MyPairs.y) // print 2
var data.MyPairs.y=3
log(data.MyPairs.y) // print 3
update data MyPairs reset
log(data.MyPairs.y) // print 2
end