Reading API reference pages
Parameters, return values, examples, and compatibility notes answer different questions about an API.
Tyler copies searchTitles("maps", 3) from a library's documentation into his app. It gives back three book titles, but he wants more. Where can he find out how to ask for more?
4 minutes. No sign-up needed.
What you'll learn5 ideas
- A parameter is a named input, like
queryfor search words andlimitfor the most results. - A default is the value the library uses when you leave an optional input out, and an example's number is just one chosen value.
- A required parameter must always be given, so code that skips the search words gets rejected.
- The return value is what the code gives back, such as a list of titles, or an empty list
[]when nothing matches. - A compatibility note, like Added in version 2.0, tells you which version of the library has a feature.