Scala FAQ: How do I override the default numeric type that Scala assigns when I declare an Int
, Long
, Short
, Float
, or Double
val or var field?
Solution
If you assign 1
to a variable, Scala assigns it the type Int
:
Scala FAQ: How do I override the default numeric type that Scala assigns when I declare an Int
, Long
, Short
, Float
, or Double
val or var field?
If you assign 1
to a variable, Scala assigns it the type Int
: