sunflower/test.foo
Julius 31c3827e96
Add support for operators to custom type
This is done by implementing the required functions for your custom type.

Sadly I could not solve this by using the regular traits like `Add`,
since I can't easily check if a different trait is implemented.
2022-07-04 22:23:59 +02:00

43 lines
510 B
Plaintext

print("hello".eq("world"));
print((40 + 2).is_42() == true);
let y = 0;
def test_func(x) {
print(x);
while x < 100 {
print(x);
x = x + 1;
if x > 10 {
return "bar";
}
}
return "foo";
}
def add_one(x) {
x + 1
}
let x = test_func(y);
print(x);
print(add_one(41));
let x = 0;
if x == 0 {
x = x + 10;
}
print(x);
let x = 5;
print(if x < 10 { 20 } else { 30 });
let f1 = native_test();
let f2 = other_foo();
let f3 = f1 + f2;
print(f3);