The next few lessons will use a command line tool called a REPL. This stands for READ - EVALUATE - PRINT - LOOP. It works as follows:
Since we've installed dotnet script, we have a C# REPL available right in the terminal!
We can launch the REPL by opening our Terminal application (on a Mac machine) or our GitBash application (on Windows), entering the following text, then hitting Enter:
Regardless of operating system, we should be met with the following:
We're now in the REPL!
Before we run code, notice the last line in the command line response above reads
>. This is our command prompt. Unlike the standard terminal command prompt we learned in Intro, which looks like this:
Guest-User:Desktop epicodus_student $
...Notice the REPL precedes the command prompt with
> instead of
$, like this:
When our curriculum depicts commands meant to be run in the REPL, we'll precede them with
> instead of
$. When you see this, you are not required to type a
>. You will only type the command listed after the
If you see a command preceded with a
$, like you did in Intro, that means the command is meant for the standard terminal.
We can exit at any point by pressing
Ctrl + C.
Now that we understand the basics of the C# REPL, let's practice. In the next few lessons, we'll cover how to use strings, variables, numbers and methods with C#.
You may launch your REPL at any time by entering this command into the command line:
Commands meant to run in the REPL are preceded with a
> in our curriculum. Commands meant to run in the standard command line are still preceded with
Once open, you can exit the REPL with the
Ctrl + C command.
Lesson 1 of 5
Last updated more than 3 months ago.