Question

How do I read this argument list? Is this two values in the argument list or just one? What does the comma inside the bracket mean?

  fetch( key [,default] ) -> obj 
Était-ce utile?

La solution

I don't see anywhere on that documentation site where the notation used for argument lists is explained. However, the square brackets are frequently used to mean "optional" in programming documentation. So this means that the fetch method can be called with just one argument, or two. If you pass two, obviously you would need a comma. So these two calls would be valid:

a.fetch(k)
a.fetch(k, 5)

Autres conseils

Some context would help here, but I believe it's saying:

"pass in key to the fetch method. If you pass in a second argument it'll be used, but there is a default value if you just pass in key"

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top