Is there a way in Scala to assign a variable a value and at the same time use the value in the expression? Like so...
java.lang.Math.abs(scala.util.Random.nextInt()) / {val num = java.lang.Math.pow(10, (java.lang.Math.abs(scala.util.Random.nextInt() % 5) + 1)) } * num
I got this error...
cannot be applied to (Unit)
java.lang.Math.abs(scala.util.Random.nextInt()) / {val num = java.lang.Math.pow(10, java.lang.Math.abs(scala.util.Random.nextInt() % 7)) } * num
In order to round down to a variable exponentiation of the value '10', I want to assign some random integer to the variable "num" use the same value in an expression at same time. So then I can make sure num will be the same value for the divisor will be the same as the multiplier. I know I have seen something in scala that made me think I can do this...