aboutsummaryrefslogtreecommitdiff
path: root/examples/learn/33-const-fixed.zc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/learn/33-const-fixed.zc')
-rw-r--r--examples/learn/33-const-fixed.zc14
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/learn/33-const-fixed.zc b/examples/learn/33-const-fixed.zc
new file mode 100644
index 0000000..bbc85ec
--- /dev/null
+++ b/examples/learn/33-const-fixed.zc
@@ -0,0 +1,14 @@
+namespace;
+include rt;
+int first(const fixed int[2] values) { return values[0]; }
+fn main() {
+ const fixed int[2] a = {7, 8};
+ fixed const int[2] b = {2, 3};
+ fixed int[2] c = {5, 6};
+ int copy = a[0];
+ copy++;
+ rt.put_n(first(a)); rt.put_c(32);
+ rt.put_n(first(b)); rt.put_c(32);
+ rt.put_n(first(c)); rt.put_c(32);
+ rt.put_n(copy); rt.put_c(10);
+}