Created
August 29, 2018 05:06
-
-
Save iamchiwon/560671de493be4fc354b393d59899d02 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
| func lastValue<T>(_ initValue: T) -> (T) -> T { | |
| var value: T = initValue | |
| return { newValue in | |
| let last = value | |
| value = newValue | |
| return last | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment