+ 1

Square root in Swift 4

Hi guys, I want to ask: how do you calculate square root in Swift 4? Normally we use sqrt, but it seems that there's no sqrt in Swift 4. Thank you ^^

7th Mar 2021, 7:26 AM
Nguyễn Vĩnh HẢO
Nguyễn Vĩnh HẢO - avatar
2 Respuestas
+ 4
let x = 4.0 let y = x.squareRoot() print(y) Simplest way to find the square root
7th Mar 2021, 7:34 AM
Sharique Khan
Sharique Khan - avatar
+ 2
Thanks mate
7th Mar 2021, 8:24 AM
Nguyễn Vĩnh HẢO
Nguyễn Vĩnh HẢO - avatar