Collapse (?) An Array?

Dave Cragg dave.cragg at lacscentre.co.uk
Thu Sep 1 07:27:47 EDT 2011


On 1 Sep 2011, at 10:53, Scott Rossi wrote:

> Sorry, I don't know the correct verbiage here...
> 
> If I script this:
> 
> put "A" into theArray[1]
> put "B" into theArray[2]
> put "C" into theArray[3]
> 
> 
> And then script this:
> 
> delete variable theArray[2]
> 
> 
> I essentially get an array with entries that look like this:
> 
> A
> 
> C
> 
> How can I collapse (?) the array after deleting element 2 so that the array
> only has two elements remaining?
> 
> A
> C
> 

Scott

I think the array is already collapsed.

on mouseUp
   put "A" into theArray[1]
   put "B" into theArray[2]
   put "C" into theArray[3]
   
   delete variable theArray[2]
   
   repeat for each element el in theArray
      put el & cr after tOut
   end repeat
   
   put tOut
end mouseUp

This gives:

A
C

What are you doing to get 

A

C

Dave




More information about the Use-livecode mailing list