Lesson Weekend

Now that .NET 5 and C# are installed on our machines, we'll install dotnet script.

dotnet script

As mentioned in Welcome to C#, C# is a compiled language. In order to experiment with C#, we'll need a tool called a REPL, which stands for read-evaluate-print-loop. This allows us to run code a line at a time. This way we can practice, test, experiment, and have fun with C#.

We'll install and use a REPL called dotnet script. We can install dotnet script with the following terminal command:

dotnet tool install -g dotnet-script

Note that .NET 5 needs to be installed for this command to work. If you just installed .NET 5, restart the terminal. (Otherwise, you will not be able to run the following command.) Enter dotnet script in your terminal and a prompt will open:


To try the REPL feature, enter:

string hello = "hello world";

and then call the variable:


To exit the REPL press Ctrl + C.

Lesson 3 of 5
Last updated February 25, 2021