doc: add subscript, pkg-access, and tuple expressions to sample file

This commit is contained in:
2024-12-08 19:37:33 +00:00
parent 8b8a97c9a6
commit 3060bb1206

View File

@@ -140,3 +140,21 @@ pkg = { 10, 2 => "Hello", 9, 5 => "World", 14 }.
pkg = { { 0 }, { 1 }, { y for y in huh } }.
pkg = { x multiplyBy:2 for x in wow if x > 2 }.
pkg->x = 32.
K = (1 multiplyBy:2, 4).
for (x, y) in pkg do
cout put:'{x}: {y}'
end
pkg[0] = 16.
/* All of these accesses are equivalent */
pkg['x'] = 32.
pkg->x = 32.
pkg put:32 at:'x'.
index = 'x'.
pkg[index] = 32.
pkg put:32 at:index.