When I look up some documents, I often see functionfuncname ([arg1 [, arg2 [..., argn]) {statements} or the rhinoceros varname_1 [value_1] [,..., name_n [value_n]. Similarly, it is often found in the php or css manual... I often see this method when I look up some documents.
In the rhino book
function funcname([arg1 [, arg2 [..., argn]]]){ statements }
Or a rhino book
var name_1 [ = value_1][,..., name_n [= value_n]]
For example, I often see this square brackets in the php or css manuals. How can I understand this square brackets?
Why can't I write it as follows?
function funcname(arg1, arg2, argn){ statements}
var name_1 = value_1, ..., name_n = value_n
Reply content:
I often see this method when I look up some documents.
In the rhino book
function funcname([arg1 [, arg2 [..., argn]]]){ statements }
Or a rhino book
var name_1 [ = value_1][,..., name_n [= value_n]]
For example, I often see this square brackets in the php or css manuals. How can I understand this square brackets?
Why can't I write it as follows?
function funcname(arg1, arg2, argn){ statements}
var name_1 = value_1, ..., name_n = value_n
Square brackets refer to optional parameters, that is, they are optional parameters, and there is no limit on the number. You can enter 0 or N parameters.
Optional parameter. Optional.