Created
March 8, 2019 12:49
-
-
Save developer-sdk/8e5e2fe373622b028fcf1494d38b6989 to your computer and use it in GitHub Desktop.
스칼라,커링
This file contains hidden or 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
| def modN(n: Int)(x: Int) = ((x % n) == 0) | |
| // modN함수를 커링을 이용하여 n 값이 정해진 변수로 호출 | |
| def modOne:Int => Boolean = modN(1) | |
| def modTwo = modN(2) _ | |
| println(modOne(4)) // true | |
| println(modTwo(4)) // true | |
| println(modTwo(5)) // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment