Advertisement
Guest User

Untitled

a guest
Jul 31st, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. func calcCircumWithRadius(value:Float) -> Float {
  2. return value*2*3.14
  3. }
  4.  
  5. func calcCircumWithDiameter(value:Float) -> Float {
  6. return value*3.14
  7. }
  8.  
  9. func getCalcCircum(#isRadius:Bool) -> (Float)->Float {
  10. if isRadius==true {
  11. return calcCircumWithRadius
  12. }
  13. return calcCircumWithDiameter
  14. }
  15.  
  16. var function = getCalcCircum(isRadius: true)
  17. function(5)
  18.  
  19. function = getCalcCircum(isRadius: false)
  20. function(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement