Calculate square root of a number

 Problem

I want to calculate the square root of a given number.



 Recipe


// Set the number
let n = 4.0

// Get the square root
let sq = sqrt(n)

print(sq)
				

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)

 

 Playground