Skip to content
BENIBIX Learn

Read-Eval-Print Loop (REPL)

Development🛠️ Editors & ToolsInteractive Coding

Also known as REPL, Interactive Shell, Python Shell, Node REPL

A prompt where you type one line of code and see the answer at once.

Think of it like

It is like a calculator. You type a sum, press enter, and the answer shows up at once.

Example

Emma is not sure how Python rounds 2.5. She opens a REPL, types round(2.5), and sees 2 in a second.

Why it matters

You can test a small idea in seconds, without making a file. It is also how many people first learn a language.

Definition

A REPL is a prompt where you type one line of code and see the answer at once. It reads your line, runs it, prints the result, then waits for the next one. Many languages come with one. Type python3 or node in a terminal and you are in it. It is the quickest way to try out a small idea.

Example code

console
$ python3
>>> 2 + 3
5
>>> "hi".upper()
'HI'
Each line runs as soon as you press Enter, and the answer prints under it.
The loop on the left, and a Python prompt doing one turn of it.

Common mistake

Building a real program in it. When you close the REPL the code is gone, so save anything you want to keep in a file.

Key takeaways

  1. 1
    Read, run, print. Then it waits for the next line.
  2. 2
    One line at a time. Good for trying, not for building.
  3. 3
    Nothing is saved. Copy what works into a real file.

Learn it properly