Last active
August 29, 2015 14:13
-
-
Save tinpay/0591eea22b36344fb794 to your computer and use it in GitHub Desktop.
外部引数名を使って関数を定義する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//外部引数名を定義 | |
func convertSeconds(hour h:Int , minutes m:Int) -> Int{ | |
return 60 * (60 * h + m ) | |
} | |
//外部引数名と引数名が同じ場合 | |
func convertSeconds2(#hour:Int , #minutes:Int) -> Int{ | |
return 60 * (60 * hour + minutes ) | |
} | |
// | |
convertSeconds(hour: 3, minutes: 25) //12,300 | |
convertSeconds2(hour: 3, minutes: 25) //12,300 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment