Comparisment

   - compare programming languages by example

37

Initialise lists

Initialise linked lists to a sequence of values.

Created by sam

Add a new answer

Either add an answer for a new language or add an alternative solution.
A description is only necessary when the code is not suitably 'obvious' or to justify an alternative approach.

Haskell

list :: [Int]
list = [1,2,3]

All Haskell variables are immutable and must be initialized when declared.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.

Python

list = [1,'b',False]

No concept of uninitialised variables exist, only names which are either associated with a value or not. Lists are mutable and may contain different types of value.

Created by: sam

Edit this answer

Edit the language, code and description simultaneously.