From 8230b115de6f790aeb22a18fcf7b3a3cc8115eb6 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 6 Sep 2017 01:27:09 -0700 Subject: [PATCH] Add test.schala file With some syntax ideas --- test.schala | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 test.schala diff --git a/test.schala b/test.schala new file mode 100644 index 0000000..294bb74 --- /dev/null +++ b/test.schala @@ -0,0 +1,56 @@ + +fn main() { + +# comments are scripting-style +#{ but can also be + +}# blocks + +@annotations are with @- + +# variable expressions + var a: I32 = 20 + const b: String = 20 + + there(); can(); be(); multiple(); statements(); per_line(); + + fn yolo(a: MyType, b: YourType): ReturnType { + if a == 20 { + return "early" + } + var sex = 20 + sex + } + + for { + # infinite loop + } + + #iteration over a variable + for i <- [1..1000] { + + } + + #while loop + for a != 3 || fuckTard() { + break + } + + #monadic decomposition + for a <- maybeInt(); s <- foo() { + a + s + } + + # let statements too!! + for (a = 20 + b = fuck) { + a + b + } + + #syntax is, I guess, for , where is a bool, or a + + type Maybe = None | Some + + fuck.map(fn(x) { x + 10 }) + +}