summaryrefslogtreecommitdiff
path: root/test/hello-world.hnshn
diff options
context:
space:
mode:
Diffstat (limited to 'test/hello-world.hnshn')
-rw-r--r--test/hello-world.hnshn28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/hello-world.hnshn b/test/hello-world.hnshn
new file mode 100644
index 0000000..4d4af3d
--- /dev/null
+++ b/test/hello-world.hnshn
@@ -0,0 +1,28 @@
+const std = import('@std');
+
+function main(): void {
+ const integer: integer32 = 123;
+ const string: string = '123';
+ const array: [integer32][3] = [1, 2, 3];
+ const map: [string][string|integer32] = [
+ 'first': 1,
+ 'second': 'two',
+ 'third': 3,
+ ];
+
+ for (array) |index, value| {
+ // cool
+ }
+
+ for (map) |key, value| {
+ // also cool
+ }
+
+ for (string) |index, char| {
+ // cool?
+ const char2 = std.str.get_char_at_index(string, index);
+ }
+
+ std.str.format('cool %s', string)
+ |> print($);
+}