Created
December 6, 2015 03:20
-
-
Save soggybag/001a1cd8da3d8b8dc7f7 to your computer and use it in GitHub Desktop.
Convert Kelvin to F and C with a computed property
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
var tempC: Double { | |
get { | |
return temp - 273.15 | |
} | |
} | |
var tempF: Double { | |
get { | |
return tempC * 9/5 + 32 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment