Home > Mobile >  Comma symbol could be ignored while passing params into a function?
Comma symbol could be ignored while passing params into a function?

Time:12-09

I'm a newbie that is learning Swift from SwiftLanguageGuide-Concurrency and feel confused while reading codes:

let firstPhoto = await listPhotos(inGallery: "Summer Vacation")[0]
add(firstPhoto toGallery: "Road Trip")
remove(firstPhoto fromGallery: "Summer Vacation")

Why here has no comma after the param firstPhoto in function add and remove?

IMO the grammar should be:

add(firstPhoto, toGallery: "Road Trip")
remove(firstPhoto, fromGallery: "Summer Vacation")

So the comma symbol could be ignored while passing params into a function in Swift?

CodePudding user response:

They're typos. You should report them. Other people will find it confusing too.

  • Related