以下の内容はhttps://faithandbrave.hateblo.jp/entry/20101014/1287040025より取得しました。


Either

ScalaにもEitherあったんだな、と。

object Main {
  def foo(x : Int) : Either[String, Int] = x match {
    case 0 => Left("invalid arguments!")
    case _ => Right(x)
  }

  def result(a : Either[String, Int]) : Unit = a match {
    case Left(msg) => println("Error : " + msg)
    case Right(x) => println(x)
  }

  def main(args: Array[String]) {
    result(foo(0))
    result(foo(1))
  }
}
Error : invalid arguments!
1





以上の内容はhttps://faithandbrave.hateblo.jp/entry/20101014/1287040025より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14