Most Mirah code looks roughly like Ruby code with occasional type annotations. Here are a few quick examples.
The code for fib is largely unchanged from the Ruby version, with the only obvious difference being the type declaration. Here, a Ruby symbol :fixnum is used. In the JVM backend for Mirah, this ends up compiling to a primitive 32-bit int
if a < 2
fib(a - 1) + fib(a - 2)
Note that the return value of this method, as all methods in Mirah, is inferred from the exit points. The type inference engine will raise an error if multiple exit points have incompatible types.
Note also that fixnum is a synonym for “int” in this case. You can use either or.