Getting started with list

Other topics

Remarks:

For HTML lists see html-list.

The current list tag-info also mentions a lot about lists of expressions joined by logical (short-circuiting) operators.

Lists are a construct provided by, or created in, many programming languages and environments (especially if they provide generics) grouping same-typed objects, with an order and so often available by index, but normally without a maximum length. They are one of fundamental collections.

Possible subtopics:

  • Types of lists

Further information: Wikipedia

Availability

Various forms of lists are either a basic data type or can be fairly easily constructed in most programming environments.

For example, linked lists can be constructed if the programming language provides structures and pointers or references, or even with just two (resizable) arrays, one of next indexes and the other of the type being stored.

Simple List and Nested List

List can contain n number of items. The items in list are separated by comma

 >> a = [1,2,3]

To access an element in the list use the index. The index starts from 0

 >> a[0]
 >> 1

Lists can be nested.

>> nested_list = [ [1,2,3], ['a','b','c'] ]
>> nested_list[0]
>> [1,2,3]
>> nested_list[1][0]
>> 'a'

Contributors

Topic Id: 4514

Example Ids: 15807,28971

This site is not affiliated with any of the contributors.