On 2021-09-08 01:33, Alex Tweedly via use-livecode wrote:
But
put [1, 2, 3 ] into tVar2
isn't clear to me. If it was in Python it would be a list - but LC
doesn't have 'lists'.
Is it equivalent to
put true into tVar2[1]
put true into tVar2[2]
put true into tVar2[3] ??
and then On 08/09/2021 08:50, Mark Waddingham via use-livecode wrote:
Yes.
But I'm not sure he meant it :-)
He went on to say
A sequence in LC is a numerically-keyed array where the keys range
from 1...the number of elements.
Admittedly they are (currently) still implemented as a 'normal' array
internally, but they do have different functionality in `repeat for
each element` which iterates in numeric order, and not hash order.
This example gives a sequence - but only, basically, by coincidence. A
better example would be
put [4, 5, 7] into tV
Using the 'expansion' I used before - that would be equivalent to
put true into tV[4]
put true into tV[5]
put true into tV[7]
not a sequence - and wouldn't preserve ordering in subsequent "repeat
for each element".
I think that
put [4, 5, 7] into tV
is actually equivalent to
put 4 into tV[1]
put 5 into tV[2]
put 7 into tV[3]
But I'm happy to wait and try it out in the DP.
Alex.
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode