diff options
| author | suresh <sureshkrishnan.ai@gmail.com> | 2026-01-25 11:43:23 -0500 |
|---|---|---|
| committer | suresh <sureshkrishnan.ai@gmail.com> | 2026-01-25 11:43:23 -0500 |
| commit | 26a0b55ed5bce4ad0ba2af109cfc96da7be2e34c (patch) | |
| tree | 35ba8d7742b8ac727bfc6c4c73ab8b70f6eedb53 /examples/features | |
| parent | 0bb69cb67078dfa921b5b8a42275ef31dfbc9a56 (diff) | |
| parent | 489336b2101bf16edeec7bfc4379408eb19b936e (diff) | |
Merge branch 'main' into JsonType
# Conflicts:
# examples/data/json_config.zc
Diffstat (limited to 'examples/features')
| -rw-r--r-- | examples/features/composition.zc | 4 | ||||
| -rw-r--r-- | examples/features/comptime_fib.zc | 10 | ||||
| -rw-r--r-- | examples/features/showcase.zc | 10 |
3 files changed, 12 insertions, 12 deletions
diff --git a/examples/features/composition.zc b/examples/features/composition.zc index 883c348..64fb8e0 100644 --- a/examples/features/composition.zc +++ b/examples/features/composition.zc @@ -21,11 +21,11 @@ struct Rigidbody { fn main() { // Mixin usage - flattened fields - var t = Transform{ x: 10.0, y: 5.0, rotation: 90.0 }; + let t = Transform{ x: 10.0, y: 5.0, rotation: 90.0 }; println "Transform pos: ({t.x}, {t.y})"; // Named usage - nested fields - var rb = Rigidbody{ + let rb = Rigidbody{ position: Vector2{x: 0.0, y: 10.0}, velocity: Vector2{x: 1.0, y: 0.0}, mass: 50.0 diff --git a/examples/features/comptime_fib.zc b/examples/features/comptime_fib.zc index 1ad2898..278ae9f 100644 --- a/examples/features/comptime_fib.zc +++ b/examples/features/comptime_fib.zc @@ -1,17 +1,17 @@ fn main() { comptime { - var N = 20; - var fib: long[20]; + let N = 20; + let fib: long[20]; fib[0] = (long)0; fib[1] = (long)1; - for var i=2; i<N; i+=1 { + for let i=2; i<N; i+=1 { fib[i] = fib[i-1] + fib[i-2]; } printf("// Generated Fibonacci Sequence\n"); - printf("var fibs: int[%d] = [", N); - for var i=0; i<N; i+=1 { + printf("let fibs: int[%d] = [", N); + for let i=0; i<N; i+=1 { printf("%ld", fib[i]); if (i < N-1) printf(", "); } diff --git a/examples/features/showcase.zc b/examples/features/showcase.zc index eca5480..d03fe81 100644 --- a/examples/features/showcase.zc +++ b/examples/features/showcase.zc @@ -66,20 +66,20 @@ fn main() { defer { println "Cleaning up resources..."; } println "=> Generics and traits."; - var btn = Button { + let btn = Button { label: "Submit", width: 120, height: 40 }; - var container = Container<Button> { item: btn }; + let container = Container<Button> { item: btn }; - var b = container.get(); + let b = container.get(); b.draw(); println ""; println "=> Enums and pattern matching."; - var events: Event[4] = [ + let events: Event[4] = [ Event::Click(Point { x: 150, y: 300 }), Event::KeyPress('Z'), Event::Click(Point { x: 42, y: 0 }), @@ -92,7 +92,7 @@ fn main() { println ""; println "=> Lambdas"; - var sum = run_op(10, 20, (a, b) -> a + b); + let sum = run_op(10, 20, (a, b) -> a + b); println "10 + 20 = {sum}"; println ""; } |
