So, I'm a bit new to Scala, and I don't really understand how it reads code, compared to other languages.
Take this simple example:
@main
def roll():Int =
var x:Int = (math.random*6+1).toInt
return x
def print =
for i <- 1 to 10 do
println(roll())
The above code returns nothing, however, should I flip the methods (put print "method" before "roll"), it will now work. I find this incredibly strange. Where have I done wrong? I just simply want to call a method/function that randomizes a number, and print it using a new function to call it. Anyone who can help me?