Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do the brackets around the arguments mean when reading documentation for a method? [duplicate]

Tags:

Often when reading documentation on what arguments can be passed to a method, I see brackets used within the arguments list like this:

example of brackets used within arguments on method documentation

What do the brackets mean in this context? Why are the commas inside the brackets?

like image 913
Cooper Maruyama Avatar asked Feb 09 '14 01:02

Cooper Maruyama


People also ask

What do brackets mean in documentation?

Square brackets indicate optional parts of a statement. They should not be entered. In many cases, items in the square brackets are optional because default values are provided. | A vertical bar indicates a choice between two or more items or values, usually within square brackets or curly braces.

Which brackets are used to give function arguments?

Almost all functions require arguments enclosed in parentheses and separated by commas. If arguments are required, do not place any spaces between the function name and the left parenthesis. Syntax rules must be followed.

What do brackets around a variable mean in Python?

The square brackets tell Python that this is a list comprehension, producing a list. If you use curly braces, you'll get either a set or a dict back, and if you use regular parentheses, you'll get a generator expression (see above).

What do square brackets mean in a IF function?

The square brackets indicate that these arguments are optional. You can leave them out.


1 Answers

required [optional] <required> [<optional>, <but both needed>].

This is almost always the case.

like image 182
Zoey Mertes Avatar answered Oct 13 '22 16:10

Zoey Mertes