Add some things to test.schala
Still playing with syntax
This commit is contained in:
parent
57d4222746
commit
5e0c7e5a95
31
test.schala
31
test.schala
@ -14,6 +14,18 @@ fn main() {
|
||||
|
||||
there(); can(); be(); multiple(); statements(); per_line();
|
||||
|
||||
#string interpolation
|
||||
const yolo = "I have ${a + b} people in my house"
|
||||
|
||||
# let expressions ??? not sure if I want this
|
||||
let a = 10, b = 20, c = 30 in a + b + c
|
||||
|
||||
#list literal
|
||||
const q = [1,2,3,4]
|
||||
|
||||
#lambda literal ?? maybe? not sure how this should work
|
||||
q.map(|item| { item * 100 })
|
||||
|
||||
fn yolo(a: MyType, b: YourType): ReturnType<Param1, Param2> {
|
||||
if a == 20 {
|
||||
return "early"
|
||||
@ -22,6 +34,7 @@ fn main() {
|
||||
sex
|
||||
}
|
||||
|
||||
|
||||
for {
|
||||
# infinite loop
|
||||
}
|
||||
@ -47,6 +60,17 @@ fn main() {
|
||||
a + b
|
||||
}
|
||||
|
||||
|
||||
# pattern-matching
|
||||
match <expr> {
|
||||
Some(a) => {
|
||||
|
||||
},
|
||||
None => {
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
#syntax is, I guess, for <expr> <brace-block>, where <expr> is a bool, or a <arrow-expr>
|
||||
|
||||
# type level alises
|
||||
@ -65,11 +89,4 @@ fn main() {
|
||||
fn lug(self, a: Option<Self>)
|
||||
}
|
||||
|
||||
|
||||
type <name> = struct { <field> : <type>,* }
|
||||
type <name> = Variant1 | Variant2(type, type) | Variant3 struct { }
|
||||
|
||||
|
||||
fuck.map(fn(x) { x + 10 })
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user