From 3060bb12060e7ea63b5f8e6afcceb1fd6033abf4 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 8 Dec 2024 19:37:33 +0000 Subject: [PATCH] doc: add subscript, pkg-access, and tuple expressions to sample file --- doc/sample/Expressions.im | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/sample/Expressions.im b/doc/sample/Expressions.im index 5f1e3b2..4a50272 100644 --- a/doc/sample/Expressions.im +++ b/doc/sample/Expressions.im @@ -139,4 +139,22 @@ pkg = { 1, 2, 3, 4, 5 }. 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 }. \ No newline at end of file +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. \ No newline at end of file