summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorNic Gaffney <gaffney_nic@protonmail.com>2025-10-23 16:54:54 -0500
committerNic Gaffney <gaffney_nic@protonmail.com>2025-10-23 16:54:54 -0500
commitc658b86a0770ba99c51bdf4e2df9544363468253 (patch)
treec7dc0b3f340f818b364b322200d9cc9d92460fd2 /examples
parent2c44d648157a6dbfd847e939016316032c6742a4 (diff)
downloadcalico-c658b86a0770ba99c51bdf4e2df9544363468253.tar.gz
Updated to zig 0.15.1 -- BREAKING
Diffstat (limited to 'examples')
-rw-r--r--examples/array.nya3
-rw-r--r--examples/for.nya7
-rw-r--r--examples/helloWorld.nya5
-rw-r--r--examples/struct.nya0
-rw-r--r--examples/sum.nya5
5 files changed, 13 insertions, 7 deletions
diff --git a/examples/array.nya b/examples/array.nya
new file mode 100644
index 0000000..5140bdf
--- /dev/null
+++ b/examples/array.nya
@@ -0,0 +1,3 @@
+fn main() -> i32 {
+ const: [i32] nums = [1, 2, 3, 4, 5, 6, 7];
+}
diff --git a/examples/for.nya b/examples/for.nya
new file mode 100644
index 0000000..030e17d
--- /dev/null
+++ b/examples/for.nya
@@ -0,0 +1,7 @@
+fn main() -> i32 {
+ const: [i32] nums = 0..10;
+ varbl: i32 sum = 0;
+ for(0..10 : i) {
+ sum = sum + i;
+ }
+}
diff --git a/examples/helloWorld.nya b/examples/helloWorld.nya
index 625860c..b8048db 100644
--- a/examples/helloWorld.nya
+++ b/examples/helloWorld.nya
@@ -1,8 +1,5 @@
import fn puts(str: [u8]) -> i32;
fn main() -> i32 {
- varbl: i32 pog = puts("Hello World!");
- pog = 8;
- const value = pog;
- return value;
+ return puts("Hello World!\n");
}
diff --git a/examples/struct.nya b/examples/struct.nya
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/examples/struct.nya
diff --git a/examples/sum.nya b/examples/sum.nya
index 78b33eb..e67a44e 100644
--- a/examples/sum.nya
+++ b/examples/sum.nya
@@ -1,12 +1,11 @@
fn main() -> i32 {
- const input = 10;
+ const: i32 fake = "fake number";
+ const: i32 input = 10;
varbl: i32 sum = 0;
varbl: i32 i = 0;
-
while (i < input) {
sum = sum + i;
i = i + 1;
}
-
return sum;
}