doc: add subscript, pkg-access, and tuple expressions to sample file
This commit is contained in:
@@ -140,3 +140,21 @@ pkg = { 10, 2 => "Hello", 9, 5 => "World", 14 }.
|
|||||||
pkg = { { 0 }, { 1 }, { y for y in huh } }.
|
pkg = { { 0 }, { 1 }, { y for y in huh } }.
|
||||||
|
|
||||||
pkg = { x multiplyBy:2 for x in wow if x > 2 }.
|
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.
|
||||||
Reference in New Issue
Block a user