2017-10-16 45 views
-1

我正在练习从https://www.scala-exercises.org/std_lib/implicits斯卡拉暗示练习

对于下列问题,我的答案似乎不正确,但我不知道为什么。

object MyPredef { 

    class KoanIntWrapper(val original: Int) { 
    def isOdd = original % 2 != 0 

    def isEven = !isOdd 
    } 

    implicit def thisMethodNameIsIrrelevant(value: Int) = 
    new KoanIntWrapper(value) 
} 

import MyPredef._ 
//imported implicits come into effect within this scope 
19.isOdd should be(true) //my answer but it seem incorrect 
) 
20.isOdd should be(false) //my answer but it seem incorrect 

的错误是There was a problem evaluating your answer, please try again later.

+1

请忽略此问题。问题发生是因为我的会话超时了。 –

回答

2

正确的答案是truefalse相应地,所以你的答案是正确的。

你有多余的右括号:

19.isOdd should be(true) //my answer but it seem incorrect 
) // <-- HERE 
20.isOdd should be(false) //my answer but it seem incorrect 

祝你好运与学习Scala。


现在检查了这个练习,一切正常。所以这似乎是一些暂时的问题。

enter image description here