blob: de4b7ba3f802a452be2abed4c4b4004f4f002d9f [file] [log] [blame]
#if BEFORE
public struct ChangeLazyToComputed {
private var celsius: Int
public init(celsius: Int) {
self.celsius = celsius
}
public lazy var fahrenheit: Int = (celsius * 9) / 5 + 32
}
#else
public struct ChangeLazyToComputed {
private var celsius: Int
public init(celsius: Int) {
self.celsius = celsius
}
public var fahrenheit: Int {
mutating get {
return (celsius * 9) / 5 + 32
}
set {
celsius = ((newValue - 32) * 5) / 9
}
}
}
#endif