**Sample Code to Recap:**

Calculate area of circle using variables and print statement:

let radius = 5.0 let pi = 3.14159 let area = pi * (radius * radius) print("The area of a circle with radius \(radius) is \(area)")

**I learned how to simplify that print statement and created a version 1.1:**

print("The area of a circle with radius ",radius," is ",area)

**What about?**

let area = pi * pow(radius,2)

Turns out: To use the pow function, something called the Foundation library (framework) has to be imported to your program.

This library helps you with common programming tasks that aren’t covered by the core Swift language and its standard library

**UPDATE!!: Writing ****pow(radius,2)**** is an important correction to what I said in the episode!
The area of a circle with radius 5 is most definitely NOT 9817.46875!**

**SO my improved (1.2) version of the Area of a Circle calculator is:**

import Foundation let radius = 5.0 let pi = 3.14159 let area = pi * pow(radius,2) print("The area of a circle with radius ",radius," is ",area)

## Recent Comments