Skip to content

Commit c51da19

Browse files
committed
Update tutorial
1 parent 3830e8a commit c51da19

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

lib/node_modules/@stdlib/repl/docs/tutorials/read_eval_print_loop.txt

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,21 @@
1818

1919
---
2020

21-
To end the tutorial at any time, enter
21+
As this tutorial is a REPL presentation, enter
2222

2323
```javascript
2424
presentationStop();
2525
```
2626

27-
followed by \*RETURN\s.
27+
followed by \*RETURN\s to end this tutorial at any time.
28+
29+
• Enter
30+
31+
```javascript
32+
quit();
33+
```
34+
35+
to exit the REPL altogether.
2836

2937
---
3038

@@ -299,7 +307,30 @@ no result is printed.
299307

300308
---
301309

302-
TODO: ans
310+
During iterative development, you'll occasionally forget to assign the
311+
results of the last expression or statement.
312+
313+
Fortunately, the REPL has a special variable which stores the last result:
314+
\*ans\s.
315+
316+
For example, run the previous statement
317+
318+
```javascript
319+
1+1;
320+
```
321+
322+
followed by
323+
324+
```javascript
325+
ans
326+
```
327+
328+
to see that \*ans\s is assigned the value \*2\s.
329+
330+
---
331+
332+
While not encouraged for general use, \*ans\s can be used just like any
333+
other variable within the top-level scope.
303334

304335
---
305336

0 commit comments

Comments
 (0)