Why is this handmade square root function in Swift not returning the value, but throws the error?
Advertisements Just trying to create an analog of sqrt() in Swift, but it throws .noRoot in all the matched cases. Also I add the error .outOfBound, this is working correctly. import UIKit enum WrongNumber: Error { case outOfBounds case noRoot } func mySqrt(_ number: Int) throws -> Int { if number < 1 || number… Read More Why is this handmade square root function in Swift not returning the value, but throws the error?