Skip to content

Instantly share code, notes, and snippets.

@RobertFischer
Created September 30, 2014 15:47
Show Gist options
  • Save RobertFischer/a6505037471c89aa3d03 to your computer and use it in GitHub Desktop.
Save RobertFischer/a6505037471c89aa3d03 to your computer and use it in GitHub Desktop.
When Option.get() isn't...
scala> var opt = Some("Foo")
opt: Some[String] = Some(Foo)
So far, so good. I want to get the value from my Some. Checking the API for Option, and there's a .get() to retrieve the value — http://www.scala-lang.org/api/current/index.html#scala.Option
scala> opt.get()
<console>:9: error: not enough arguments for method apply: (index: Int)Char in class StringOps.
Unspecified value parameter index.
opt.get()
^
Wait, what?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment