Files
freeCodeCamp/guide/english/csharp/hello-world/index.md
Max Dionysius 910b1baaf7 Added return type information of WriteLine (#21913)
* Added return type information of WriteLine

* Fixed grammar
2018-11-16 21:50:35 -05:00

661 B

title
title
Hello World

Hello World

To write some text on the console we use the Console.WriteLine(). This method takes a string as input and has a return type of void.

Example

using System;

namespace HelloWorld
{
    class Hello
    {
        static void Main()
        {
            // Write "Hello World!" on console
            Console.WriteLine("Hello World!");

            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
    }
}

Output:

> Hello World!
> Press any key to exit.