aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
Diffstat (limited to 'code')
-rw-r--r--code/demo.odin7
1 files changed, 7 insertions, 0 deletions
diff --git a/code/demo.odin b/code/demo.odin
index 4b4781323..272ef0ec2 100644
--- a/code/demo.odin
+++ b/code/demo.odin
@@ -10,6 +10,13 @@
#import "utf8.odin";
main :: proc() {
+ T :: struct { x, y: int }
+ foo :: proc(using immutable t: T) {
+ a0 := t.x;
+ a1 := x;
+ x = 123; // Error: Cannot assign to an immutable: `x`
+ }
+
// foo :: proc(x: ^i32) -> (int, int) {
// fmt.println("^int");
// return 123, int(x^);