Last active
May 19, 2018 14:49
-
-
Save dineshba/0e726c61ffbebd273664fbdf2dff4178 to your computer and use it in GitHub Desktop.
This file contains 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
extension Double { //swift class | |
func half() -> Double { | |
return self / 2 | |
} | |
} | |
1.3.half() //0.6500000000000000 | |
1000.0.half() // 500 | |
Double(999).half() // 499.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment