2017-10-16 77 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