tomatenmhark: mers
see the repo on github or
try to write some code (available if mers is listed as running on tomatenmhark.org)
hello, world!
"hello, world!".println
stdout: hello, world!
variables
my_variable := "hello, world!"
my_variable.println
stdout: hello, world!
adding two integers
a := 5
b := 10
a.add(b)
output: 15
a simple function
double := a -> a.add(a)
5.double
output: 10
causing a type error
a := "5"
b := 10
a.add(b)
error found:
╷Line 3 (1..8)
│ a.add(b)
│ ~~~~~~~~
│ ~~~
│Can't call this function with an argument of type (String, Int<10>):
└╴`add`: first argument must be `Int/Float`, but was `String`.
mixing types
some_condition := "a".eq("b")
if some_condition 5 else "not a number"
output type: Int<5>/String
output: not a number