Skip to content

Commit 7ca1ffb

Browse files
myronrezzoparlough
andauthored
Update Default parameter values information (#3766)
The current text implies that it is possible to define default values for both types of positional parameters (required and optional), as it says: "Your function can use = to define default values for both named and positional parameters.". However, positional parameters can be of 2 types, required and optional, and only the optional ones allow the definition of a default value. This change is intended to make it clear that only named and optional positional parameters are likely to have default values set. Co-authored-by: Parker Lougheed <parlough@gmail.com>
1 parent f36f1da commit 7ca1ffb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/_guides/language/language-tour.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1398,8 +1398,8 @@ assert(say('Bob', 'Howdy', 'smoke signal') ==
13981398
<a id="default-parameters"></a>
13991399
#### Default parameter values
14001400

1401-
Your function can use `=` to define default values for both named and positional
1402-
parameters. The default values must be compile-time constants.
1401+
Your function can use `=` to define default values for optional parameters,
1402+
both named and positional. The default values must be compile-time constants.
14031403
If no default value is provided, the default value is `null`.
14041404

14051405
Here's an example of setting default values for named parameters:

0 commit comments

Comments
 (0)