Skip to content

Instantly share code, notes, and snippets.

@tinpay
Last active August 29, 2015 14:13
Show Gist options
  • Save tinpay/0591eea22b36344fb794 to your computer and use it in GitHub Desktop.
Save tinpay/0591eea22b36344fb794 to your computer and use it in GitHub Desktop.
外部引数名を使って関数を定義する
//外部引数名を定義
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