Ok, so im starting to learn programming using swift and I know more than the basics but I can't figure this out. So if I'm trying to make a function with some stablished constant values and some variables it seems like I can't define constants without them acting like variables. For example, here I want to make a function for the Area of a Circle:
func CircleArea(radius: Int) {
println(radius*radius*3.1415926)
}
I also tried
struct Circle {
let pi = 3.1415926
var radius: Int
func CircleArea(pi: Int, radius: Int) {
println(radius*radius*pi)
}
}
M_PI, so you don't have to define your own.