17/02/15 18:05:13.29 WU5+o8Pm0.net
>>893
こういうので我慢してはどうだろうか?
func printDiffernce() {
struct Prev { static var value: Int? }
let curValue = getNextValue()
if let prevValue = Prev.value {
print("difference = ¥(curValue - prevValue)")
Prev.value = curValue
} else {
Prev.value = curValue
}
}
自分ならインスタンス変数使うけど