Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func calcCircumWithRadius(value:Float) -> Float {
- return value*2*3.14
- }
- func calcCircumWithDiameter(value:Float) -> Float {
- return value*3.14
- }
- func getCalcCircum(#isRadius:Bool) -> (Float)->Float {
- if isRadius==true {
- return calcCircumWithRadius
- }
- return calcCircumWithDiameter
- }
- var function = getCalcCircum(isRadius: true)
- function(5)
- function = getCalcCircum(isRadius: false)
- function(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement