Table of contents
  1. 1. Usage Restrictions
  2. 2. Parameters
  3. 3. Result
  4. 4. Samples
List.New(size : int, value : any?) : list

Create a list of a given size.

Usage Restrictions

9.02 or later.

Parameters

Name Type Description
size int size of the list
value any? intial value for list entry (optional, default: nil)

Result

A single value representing the combination of lists values using the supplied expression

Samples

   Output

Create a new list of nil's

{{list.new(10)}}  

[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ]

Create a new list of default values:

{{list.new(10, "happy")}} 

[ "happy", "happy", "happy", "happy", "happy", "happy", "happy", "happy", "happy", "happy" ]

 

Tag page (Edit tags)
    Viewing 1 of 1 comments: view all
    What is the purpose of the default behavior of creating a list of nils? I can't imagine when that would be useful, since you can't modify the individual list items afterwards. There must have been a use case here but I can't fathom it.

    A more useful default behavior would be to create a list from 0..size-1.
    Posted 17:56, 6 Nov 2009
    Viewing 1 of 1 comments: view all
    You must login to post a comment.