|
Yves,
To know how many lines are stored in the custom propery you can reference
the keys() function and get a line count, as in
put the number of lines of keys(cName) into numKeys
Assuming you have two keys per "index" (one is "student" and one is "prof"), you would divide 'numKeys' by 2, and then add 1 for the next index number: put (numKeys/2)+1 into nextIndexNum
Then, set your array to the next element:
set the cName[student,nextIndexNum] of <object> to
"Peter"
Note that variables can be used inside the array definition (nextIndexNum),
but if you mistype it, it will use the string as part of the array. For
example:
put 2 into Fred
set the cName[student,Fred] of this stack to "Ken"
'Fred' will be recognized as a variable and will be resolved to '2', which
will set the cName[student,2] of this stack. However, if I do this:
put 2 into Fred
set the cName[student,Fredd] of this stack to "Ken" --
Mistyped 'Fred'
'Fredd' will not be recognized as a variable and will therefore not be
resolved and will be used directly, setting the cName[student,Fredd] of this
stack.
Hope this helps,
----- Original Message -----
|
Title: Array
