Created
March 8, 2019 12:43
-
-
Save developer-sdk/2a4e1e8b78152b18a7b7c53b32d32111 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
| // a 와 b를 더하는 함수를 반환 | |
| def adder(a: Int) = (b: Int) => { | |
| a + b | |
| } | |
| // a의 값에 각각 5와 7을 바인딩, 함수가 해제하기 전까지 데이터를 저장 | |
| def addFive = adder(5) | |
| def addSeven = adder(7) | |
| println(addFive(2)) // 7 | |
| println(addSeven(8)) // 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment