Hello World

Console.WriteLine

Now we can look at how it writes "Hello World" to the screen.

using System; public class Program { ...

 

Notice line 8. Displaying output in the Console window is easy.

Console.WriteLine("Hello World");

 

A few things to keep in mind:

  • The text you want to print is in double-quotes "
  • You must include a semicolon ; after the method call WriteLine(...)

When you have an error in your code, always check your semicolons. .NET Fiddle and Visual Studio do a great job of helping you find errors, but if your semicolons are incorrect it can be hard for them to figure out what you are trying to do. This can lead to hard-to-understand error messages.

Page 3 of 13