Interior values of arrays redux
Posted: Wed May 20, 2015 8:12 pm
Just so I am sure I understand:
The value for buttonArray ["a"]["b"], which is ostensibly "5", is not available, even in the debugger, if the third level of values is set into the array. If I comment out that third level, I can see the "5" in buttonArray ["a"]["b"], but that is no surprise, since no third level was ever created.
My question is this: Is it so? Do "intermediate" values of an array become non-existent if deeper values are installed? They cannot be retrieved even if the third-level elements are deleted:
I am not interested in the keys of interior values, such as:
These are always available at any level. I am interested in that missing "5".
Craig Newman
Code: Select all
on mouseUp
-- second level of array
put "5" into buttonArray ["a"]["b"]
put "6" into buttonArray ["a"]["c"]
put "7" into buttonArray ["a"]["d"]
--third level of array
put "X" into buttonArray ["a"]["b"]["h"]
put "Y" into buttonArray ["a"]["c"]["j"]
put "Z" into buttonArray ["a"]["d"]["k"]
answer buttonArray ["a"]["b"] --yields empty unless third level is commented out, that is, never loaded
end mouseUp
My question is this: Is it so? Do "intermediate" values of an array become non-existent if deeper values are installed? They cannot be retrieved even if the third-level elements are deleted:
Code: Select all
on mouseUp
put "5" into buttonArray ["a"]["b"]
put "6" into buttonArray ["a"]["c"]
put "7" into buttonArray ["a"]["d"]
put "X" into buttonArray ["a"]["b"]["h"]
put "Y" into buttonArray ["a"]["c"]["j"]
put "Z" into buttonArray ["a"]["d"]["k"]
delete variable buttonArray ["a"]["b"]["h"]
delete variable buttonArray ["a"]["c"]["j"]
delete variable buttonArray ["a"]["d"]["k"]
answer buttonArray ["a"]["b"] --still returns empty
end mouseUpCode: Select all
the keys of buttonArray ["a"]Craig Newman