# Getting Started

## How The Tutorial Works

The tutorial is divided into a number of lessons. Each lesson introduces new concepts, and sample code is displayed to demonstrate those concepts.&#x20;

If possible, try not to copy-paste the code. Instead, type out each line. You will start building coding "muscle memory" this way.

At the end of a lesson, the tutorial will test your knowledge. There will be questions or challenges for you to complete yourself.&#x20;

Make sure that before you tackle them, you understand what exactly the question or challenge is asking for.&#x20;

Beginner programmers sometimes get stuck because they go through lessons too fast. Going too fast can cause you to make mistakes. A small mistake can radically change your understanding of a concept.

If you find yourself unable to solve a challenge, go through the lesson again. Don't be afraid to go slow: you might have missed something small.&#x20;

C# can be very strict. You need to ensure that your code is precise and follows the structure expected.

## Set Up Your Workspace

You'll use [Dotnet Interactive Notebooks](https://github.com/dotnet/interactive) as your workspace. It's an extension for Visual Studio Code (a code editor) that allows you to write and run C# code directly in a virtual notebook.

{% hint style="success" %}
**Tip**

Visual Studio Code and the Dotnet Interactive Notebooks extension can be downloaded as a single installer. Go to the [Dotnet "Learn to Code"](https://dotnet.microsoft.com/learntocode) website and download the ".NET Coding Pack".
{% endhint %}

First, download and install the [latest Dotnet ](https://dotnet.microsoft.com/en-us/download/dotnet)from the Dotnet website. The minimum version needed by Dotnet Interactive Notebooks is **5.0**.

Download and install [Visual Studio Code](https://code.visualstudio.com/).

![](https://3447149067-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdynmZrfNEt1WSSrlHq%2F-MdzSyBCvYBuu4tEQ6EI%2F-MdzWMqUlfxhCzvV09yS%2F2021-07-07_15-45-46.png?alt=media\&token=9c744ee5-069b-4e11-9e7a-b24c720a7543)

Launch Visual Studio Code. You'll see a screen similar to this one.

Open the Extensions panel by clicking the button on the sidebar, or from the menu bar by clicking on *View* then selecting *Extensions*.

![](https://3447149067-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdynmZrfNEt1WSSrlHq%2F-MdzSyBCvYBuu4tEQ6EI%2F-Mdz_N58n7YKvfJkPU7G%2F2021-07-07_15-54-17.png?alt=media\&token=71f43205-3df7-463c-b2d5-f94de3249975)

Type ".NET Interactive Notebooks" in the search bar on the Extensions panel. Click on the Install button to install the extension.

![](https://3447149067-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdynmZrfNEt1WSSrlHq%2F-MdzSyBCvYBuu4tEQ6EI%2F-Mdza89WaSrxon3nAz1Q%2F2021-07-07_16-10-52.png?alt=media\&token=26887c13-e61a-43e6-8fb5-45942cfcbd37)

Create a new Notebook by opening the Command Palette (Ctrl-Shift P in Windows, Command-Shift P on Mac) and selecting ".NET Interactive: Create new blank notebook".

{% hint style="info" %}
You can also use keyboard shortcuts: Ctrl-Shift-Alt N (on Windows) or Command-Shift-Alt N (on Mac) to create the notebook.
{% endhint %}

![](https://3447149067-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdynmZrfNEt1WSSrlHq%2F-MdzSyBCvYBuu4tEQ6EI%2F-MdzdbBbHueZzyfIRI8E%2F2021-07-07_16-14-22.png?alt=media\&token=c4c457cc-0a18-40fc-8adb-6390bc72c246)

&#x20;Select "Create as .dib" in the next section.

![](https://3447149067-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdynmZrfNEt1WSSrlHq%2F-MdzSyBCvYBuu4tEQ6EI%2F-MdzeVAOTNsOO4HYia7M%2F2021-07-07_16-29-39.png?alt=media\&token=6af8a9e6-6500-4e3a-9d8a-1586d57594c2)

Next, select "C#" as the language.

![](https://3447149067-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdynmZrfNEt1WSSrlHq%2F-MdzSyBCvYBuu4tEQ6EI%2F-MdzePfgouTXNzfd9FvY%2F2021-07-07_16-30-12.png?alt=media\&token=b624e964-25d3-4371-9c49-210fb5563cd3)

The .NET Interactive files will download if they haven't been installed yet.

When you see this screen, the notebook is ready! You can write C# code in the box.

![](https://3447149067-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdynmZrfNEt1WSSrlHq%2F-MdzSyBCvYBuu4tEQ6EI%2F-MdzfxZfY84ecJe6VFMt%2F2021-07-07_16-32-52.png?alt=media\&token=5521251f-e7a0-446d-80f8-51ff36007bc2)

To run the code, click on the Execute button on the left-hand side, or use the keyboard shortcut: Ctrl-Alt Enter (on Windows), Command-Alt Enter (on Mac).

![](https://3447149067-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdynmZrfNEt1WSSrlHq%2F-MdzSyBCvYBuu4tEQ6EI%2F-MdzgEelJfEJ4VHO19O8%2F2021-07-07_16-37-12.png?alt=media\&token=c77e16a9-e4cb-4261-95d2-819f2d1a81fb)
