|
|
@ -77,9 +77,9 @@ The special variable `_` (underscore) contains the result of the last expression |
|
|
|
> _ += 1 |
|
|
|
4 |
|
|
|
|
|
|
|
The REPL provides access to any variables in the global scope. You can expose a variable |
|
|
|
to the REPL explicitly by assigning it to the `context` object associated with each |
|
|
|
`REPLServer`. For example: |
|
|
|
The REPL provides access to any variables in the global scope. You can expose |
|
|
|
a variable to the REPL explicitly by assigning it to the `context` object |
|
|
|
associated with each `REPLServer`. For example: |
|
|
|
|
|
|
|
// repl_test.js |
|
|
|
var repl = require("repl"), |
|
|
@ -97,7 +97,14 @@ There are a few special REPL commands: |
|
|
|
|
|
|
|
- `.break` - While inputting a multi-line expression, sometimes you get lost |
|
|
|
or just don't care about completing it. `.break` will start over. |
|
|
|
- `.clear` - Resets the `context` object to an empty object and clears any multi-line expression. |
|
|
|
- `.clear` - Resets the `context` object to an empty object and clears any |
|
|
|
multi-line expression. |
|
|
|
- `.exit` - Close the I/O stream, which will cause the REPL to exit. |
|
|
|
- `.help` - Show this list of special commands. |
|
|
|
|
|
|
|
The following key combinations in the REPL have these special effects: |
|
|
|
|
|
|
|
- `<ctrl>C` - Similar to the `.break` keyword. Terminates the current |
|
|
|
command. Press twice on a blank line to forcibly exit. |
|
|
|
- `<ctrl>D` - Similar to the `.exit` keyword. |
|
|
|
|
|
|
|