Would this be the correct syntax for Swift 1.2? -


i have seen method:

func sum(x:int, y: int) -> int {    return x+y } 

would need call via:

let x1 = sum(4, y:11) 

because doesn't seem work:

let x1 = sum(4, 11) 

in method, y labelled y both internally , externally. therefore, call method, must name parameter. if want call sum method way you're describing, add underscore before y so:

func sum(x:int, _ y: int) -> int {     var j = x*y     return j } 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -