Introduction To C#
Introduction To C#
using System;
class Program
Console.WriteLine("Hello World!");
}
C# Output
To output values or print text in C#, you can use the WriteLine() method.
Examples:
Console.WriteLine("Hello Class!");
Console.WriteLine("Programming is fun!");
Output:
Hello Class!
Programming is fun!
● There is also a Write() method, which is similar to WriteLine().
● The only difference is that it does not insert a new line at the end of
the output.
Example:
Output:
➔ Single-line Comments
Single-line comments start with two forward slashes (//).
Example:
// this below line shows output.
Console.WriteLine("Hello Class!");
➔ C# Multi-line Comments
Multi-line comments start with /* and ends with */.
Example:
Console.WriteLine("Hello World!");
Backslash characters/ Escape sequences
Notation Operation
\n New line
\b Backspace
\t Horizontal tab