> For the complete documentation index, see [llms.txt](https://easonwang.gitbook.io/class/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://easonwang.gitbook.io/class/repl-zi-ding-ming-ling-lie.md).

# Repl(自訂命令列)

全名為Read-Eval-Print-Loop (REPL)

主要用來產生一個terminal終端機程式，可接受使用者從終端機的輸入做對應的輸出，或是直接將想顯示的文字輸出至終端機

一開始我們先開啟terminal，然後輸入node，進入node.js命令列

之後輸入`.help`

1.試著輸入`.editor`

然後打上如下程式

```
function welcome() {
  return `Hello!`;
}

welcome();
```

接著按下鍵盤的ctrl + D

即可看到Hello出現在terminal上

2.試著輸入 `.save ./test2.js`

發現剛才的程式存成檔案

3.再來可輸入 `.load ./test2.js` 可用來讀取並執行一個js檔案

4.點選鍵盤左上的`tab`按鈕可列出所有變數

5.試著輸入`fs.createReadStream('./test2.js');`

最後輸入兩次ctrl + C 即可退出nodejs命令列


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://easonwang.gitbook.io/class/repl-zi-ding-ming-ling-lie.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
