How is the console.writeline used in C#?

In C#, the Console.WriteLine() method is used to output text or variable values to the console, and it automatically adds a new line after the output. For example:

string name = "John";
int age = 30;
Console.WriteLine("Name: " + name);
Console.WriteLine("Age: " + age);

In the example above, the Console.WriteLine() method is used to output the values of the variables name and age, and automatically creates a new line after the output. The result of the output will be:

Name: John
Age: 30
Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds