Skip to content

Instantly share code, notes, and snippets.

@dos65
Created February 17, 2017 17:26
Show Gist options
  • Save dos65/359058bd82cfd923b684540ad286d269 to your computer and use it in GitHub Desktop.
Save dos65/359058bd82cfd923b684540ad286d269 to your computer and use it in GitHub Desktop.
scala> val f = if (_:Boolean) (_:Int) else (_:Int)
f: (Boolean, Int, Int) => Int = <function3>
scala> f(false, 2, 3)
res27: Int = 3
// почему в этом случае 2 аргумента и 2ой функция?
scala> val f2 = if (_:Boolean) (_:Int) + 1 else (_:Int) + 2
f2: Boolean => (Int => Int) = <function1>
scala> f2(false)(3)
res28: Int = 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment