Core C#

Write Versus WriteLine

This C# program demonstrates how write and writeline print messages to the console window. Note that each WriteLine() command creates a new line of text while Write() does not.

Program.cs

using System;

namespace XoaX {
    class Program {
        static void Main(string[] args) {
            Console.Write("In the beginning ");
            Console.Write("God created the heavens ");
            Console.WriteLine("and the earth. ");

            Console.WriteLine("In the beginning ");
            Console.WriteLine("God created the heavens ");
            Console.WriteLine("and the earth. ");
        }
    }
}
 

Output

In the beginning God created the heavens and the earth.
In the beginning
God created the heavens
and the earth.
Press any key to continue . . .
 
 

© 2007–2024 XoaX.net LLC. All rights reserved.