LoginSignup
3
2

More than 5 years have passed since last update.

Optionのget使っちゃダメ☆

Posted at

optionはget使わずにパターンマッチで取り出さなきゃねっていう、ただそれだけのこと。

val v = Option("a")

v match {
  case Some(s) => println(s)
  case None => "中身ないよ!"
}
3
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2