Square Root in Swift | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Square Root in Swift

Since the Swift compiler in the PlayGround here, doesn't have sqrt() (..\Playground\:1:10: error: use of unresolved identifier 'sqrt') I wrote one myself (not that accurate, but will do for what I need now... But after testing it in Xcode, I transferred it to the PlayGround hare, it has errors I don't even know how to begin understanding... https://code.sololearn.com/cIcdrTfnQQwj/#swift Can anyone help please? TIA Ronen

16th Oct 2018, 2:00 PM
Ronen Gil רונן גיל رونين جيل 🏳️‍🌈♾🇹🇩🇮🇱
Ronen Gil רונן גיל رونين جيل 🏳️‍🌈♾🇹🇩🇮🇱 - avatar
2 Answers
+ 4
So you can't even import Foundation here... But, what's important is that now it works! I have a function that finds a square root of an Int, up to the 2nd decimal place!
17th Oct 2018, 1:58 PM
Ronen Gil רונן גיל رونين جيل 🏳️‍🌈♾🇹🇩🇮🇱
Ronen Gil רונן גיל رونين جيل 🏳️‍🌈♾🇹🇩🇮🇱 - avatar
+ 1
SL code playground is limited
7th Jan 2021, 11:39 AM
Sonic
Sonic - avatar