Arrays: Difference between revisions
Content added Content deleted
(Added SSEM) |
(Lingo added) |
||
Line 3,165: | Line 3,165: | ||
</lang> |
</lang> |
||
=={{header|Lingo}}== |
|||
<lang lingo>a = [1,2] -- or: a = list(1,2) |
|||
put a[2] -- or: put a.getAt(2) |
|||
-- 2 |
|||
a.append(3) |
|||
put a |
|||
-- [1, 2, 3] |
|||
a.deleteAt(2) |
|||
put a |
|||
-- [1, 3] |
|||
a[1] = 5 -- or: a.setAt(1, 5) |
|||
put a |
|||
-- [5, 3] |
|||
a.sort() |
|||
-- [3, 5] |
|||
put a</lang> |
|||
In addition to the 'list' type shown above, for arrays of bytes (i.e. integers between 0 and 255) there is also the bytearray data type: |
|||
<lang lingo>ba = bytearray(2, 255) -- initialized with size 2 and filled with 0xff |
|||
put ba |
|||
-- <ByteArrayObject length = 2 ByteArray = 0xff, 0xff > |
|||
ba[1] = 1 |
|||
ba[2] = 2 |
|||
ba[ba.length+1] = 3 -- dynamically increases size |
|||
put ba |
|||
-- <ByteArrayObject length = 3 ByteArray = 0x1, 0x2, 0x3 > |
|||
ba[1] = 5 |
|||
put ba |
|||
-- <ByteArrayObject length = 3 ByteArray = 0x5, 0x2, 0x3 ></lang> |
|||
=={{header|Lisaac}}== |
=={{header|Lisaac}}== |
||
<lang Lisaac>+ a : ARRAY(INTEGER); |
<lang Lisaac>+ a : ARRAY(INTEGER); |