Created
December 10, 2012 16:05
-
-
Save anoopelias/4251496 to your computer and use it in GitHub Desktop.
Implicit variables in scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package concept | |
object Impicit { | |
implicit val i : Int = 1 //> i : Int = 1 | |
def add(a:Int)(implicit b:Int) = a + b //> add: (a: Int)(implicit b: Int)Int | |
add(10)(15) //> res0: Int = 25 | |
add(10) //> res1: Int = 11 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment