Calculate power of a number

 Problem

I want to calculate the power of a number: X^Y.



 Recipe


// Set the number
let n = 4.0

// Get the power n^2
let pwr = pow(n,2)

print(pwr)

				

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