From c658b86a0770ba99c51bdf4e2df9544363468253 Mon Sep 17 00:00:00 2001 From: Nic Gaffney Date: Thu, 23 Oct 2025 16:54:54 -0500 Subject: Updated to zig 0.15.1 -- BREAKING --- examples/array.nya | 3 +++ examples/for.nya | 7 +++++++ examples/helloWorld.nya | 5 +---- examples/struct.nya | 0 examples/sum.nya | 5 ++--- 5 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 examples/array.nya create mode 100644 examples/for.nya create mode 100644 examples/struct.nya (limited to 'examples') 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 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; } -- cgit v1.2.3