Creating an Array: Difference between revisions
Content added Content deleted
(→Delphi: Delete.) |
(→Groovy: Delete.) |
||
Line 336: | Line 336: | ||
9, 10, 11, 12, & |
9, 10, 11, 12, & |
||
13, 14, 15, 16 /), (/ 4, 4 /) ) )</lang> |
13, 14, 15, 16 /), (/ 4, 4 /) ) )</lang> |
||
==[[Groovy]]== |
|||
In Groovy "arrays" are synonymous with "lists", and are thus not of a fixed size. Ranges are also a type of list. |
|||
<lang groovy> |
|||
def myArray1 = [] // empty list (content may be added as desired) |
|||
def myArray2 = [1, 2, 3] // 3-element (for now) list containing first 3 integers |
|||
def myArray3 = 1..3 // the same 3-element list expressed as a range. |
|||
def myArray4 = ["xx"]*20 // 20-element (for now) list, each element of which is currently the string "xx" |
|||
</lang> |
|||
==[[Haskell]]== |
==[[Haskell]]== |