aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/const_local.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/programs/const_local.zc')
-rw-r--r--tests/programs/const_local.zc11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/programs/const_local.zc b/tests/programs/const_local.zc
new file mode 100644
index 0000000..83c423c
--- /dev/null
+++ b/tests/programs/const_local.zc
@@ -0,0 +1,11 @@
+// a local const without a type takes its initializer's type and can't be written.
+include rt;
+fn main() {
+ const k = 6, j = k * 7;
+ const half = 2.5;
+ const name = "zc";
+ int typed = j;
+ rt.put_n(k); rt.put_c(32); rt.put_n(typed); rt.put_c(32);
+ if (half > 2.0) rt.put_s(name);
+ rt.put_c(10);
+}