Skip to content

Commit 48d79a4

Browse files
committed
doc: warn about reassigning _ in REPL
When users assign a value to `_` in REPL, it is prone to unexpected results or messing up with REPL's internals. For example, #3704. This patch issues a warning about the same.
1 parent c2a3731 commit 48d79a4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/api/repl.markdown

+4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ The special variable `_` (underscore) contains the result of the last expression
8686
4
8787
```
8888

89+
*NOTE*: Explicitly assigning a value to `_` in the REPL can produce unexpected
90+
results. Also, attempting to create `_` as a `const` variable in the REPL will
91+
fail.
92+
8993
The REPL provides access to any variables in the global scope. You can expose
9094
a variable to the REPL explicitly by assigning it to the `context` object
9195
associated with each `REPLServer`. For example:

0 commit comments

Comments
 (0)