Comment

Comment by yen223

Not having keys in function parameters is a mistake.

Swift does have an unconventional approach to function keys though, wherein you can specify an "external" label and an "internal" label:

  func greeting(for person: String) -> String {
      "Hello, " + person + "!"  // the argument is "person" inside the function body...
  }
  print(greeting(for: "Dave"))  // ... but it's "for" when calling the function
I'm not sure if I like it or hate it, but it is cool.
parent yen223 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton