Creating Arrays

Thus far, to my understanding, it seems that containers are created upon storing a known value into them. But what if I wanted to create a container of certain dimensions without a stored value? Just define it beforehand. Is this possible?

Comments

  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    No, there's no need to specify a size for a list in advance (and no way to do that). Lists grow dynamically to accommodate whatever is assigned to them.

    You can initialize a variable to an empty list, which is sometimes useful to ensure that it is treated as a list from the start, although inserting a value (with the insert command) will turn a variable into a list in any case.
    set myList to an empty list
    -- or --
    set myList to () -- also an empty list
    -- or --
    insert 7 into myList -- myList will now be a list
    
Sign In or Register to comment.