Introduction to C# Beginner Course

Inline Code and Interactive Code

In addition to normal text, there are three main elements to the tutorials:

  • Static Code Blocks
  • Interactive Code
  • Exercises

Let's take a look at the first two of those.

 

Static Code

Here is an example of some static code.

Console.WriteLine("Hello World");

The static code does not execute. In most cases it is not a full program, just a colour-coded chunk of code.

 

Interactive Code

Interactive Code lets you play with code and see your changes in real-time.

Try it with this interactive example:

using System; public class Program { p...

 

  • On line 7, change "Hello World" to "Hello Universe". Notice how the output at the bottom changes within a few seconds. That is the code executing live.
  • Let's break it! To simulate a typo, change Console.WriteLine to Console.WriteLine. Notice how that causes a little red X to appear in the left-hand side? If you hover your mouse over the red X, you'll see a short description of the error. You will also see a little red squiggly-line near the error.

Notice the icons in the upper right hand corner. The clipboard icon will copy the code to the clipboard. The cloud icon, on the right will open the code in .NET Fiddle.

 

Useful Tip

 

If you ever really mess up an example and can't seem to fix it, don't worry! There is an easy way, just refresh your browser. You can't break anything. Play, and have fun...
 

 

 

Page 3 of 8