RosettaCodeData/Task/Arrays/Lingo/arrays-2.lingo
2016-12-05 23:44:36 +01:00

11 lines
346 B
Text

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 >