Why do I get a Some instead of a String in Scala

scala

Solution

You are unnecessarily calling `toString()` on `Option[String]` (which `Play.current.configuration.getString()` returns), try this:

def config(s: String) = Play.current.configuration.getString(s).get

or maybe preferably:

Play.current.configuration.getString(s).getOrElse("some default")

Problem

Why do I get a [Some] Object instead of a [String] Object? The Some object won't work as a String Parameter in a method call. The `config def` returns a `String` so I expect the type to be `String`. But when I type "Hello" Scala get's it correct. Code ``` def config(s: String) = Play.current.configuration.getString(s).toString() Logger.info(config("recaptcha.publicKey")) Logger.info("Hello") ``` Output ``` [info] application - Some(6LeDMdASAAAAAC4CFIDY-5M7NEZ_WnO0NO9CSdtj) [info] application - Hello ```

Original source