Skip to content

Instantly share code, notes, and snippets.

@kamiyaowl
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamiyaowl/6fe23e9f7c807a21b919 to your computer and use it in GitHub Desktop.
Save kamiyaowl/6fe23e9f7c807a21b919 to your computer and use it in GitHub Desktop.
implicit patrameter <<<< default parameter
def hoge(implicit str:String = "default", num:Int = 0) = println(str,num)
implicit val str2 = "implicit str2"
implicit val num2 = 123
hoge()//(default,0)
hoge(str2,num2)//(implicit str2,123)
hoge(str2)//(implicit str2,0)
hoge(num = 456)//(default,456)
hoge(str = str2)//(implicit str2,0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment