Getting started with list

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'


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.