嗨,我只是尝试我的第一部分scala并且遇到了这个我不明白的错误.我一直在尝试解决这个问题,并且已经用尽了我的想法.救命?
scala> def calculate(count: Int) : Boolean =
| if (count<0) false
<console>:8: error: type mismatch;
found : Unit
required: Boolean
if (count<0) false
^
Run Code Online (Sandbox Code Playgroud)
谢谢
scala> class Rectangle (Length: Int, Width: Int) {; def getLlength (): Int = println (Length); def getWidth ():Int = println (Width); }
<console>:11: error: type mismatch;
found : Unit
required: Int
class Rectangle (Length: Int, Width: Int) {; def getLlength (): Int = println (Length:Int); def getWidth ():Int = println (Width:Int); }
^
<console>:11: error: type mismatch;
found : Unit
required: Int
class Rectangle (Length: Int, Width: Int) {; def getLlength (): Int = println (Length:Int); def getWidth ():Int = …Run Code Online (Sandbox Code Playgroud)