aboutsummaryrefslogtreecommitdiff
path: root/test/data/constants.yx
diff options
context:
space:
mode:
Diffstat (limited to 'test/data/constants.yx')
-rw-r--r--test/data/constants.yx17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/data/constants.yx b/test/data/constants.yx
new file mode 100644
index 0000000..cc9e6df
--- /dev/null
+++ b/test/data/constants.yx
@@ -0,0 +1,17 @@
+/* Basic definitions, with Unicode support */
+π :: 3.14159265358979323846264338327950288419716939937510582097494459;
+MEANING_OF_LIFE :: 42;
+
+/* You can use them in expressions, and they can be defined
+ out-of-order */
+foo :: () int {
+ x := MEANING_OF_LIFE;
+ return x + MOL_DBL;
+ MOL_DBL :: MEANING_OF_LIFE * 2;
+}
+
+/* You can perform constant shadowing */
+bar :: () int {
+ MEANING_OF_LIFE :: MEANING_OF_LIFE + 1;
+ return MEANING_OF_LIFE;
+}