C# TutorialLesson 5Free preview
C# Output
This lesson is part of C# · All levels
Summary
The base output is printed with Console.WriteLine that adds a new line, or Console.Write that remains on the same line. Dynamic text can be compiled using a placeholder such as {0}, through string.Format, or with a string interpolation beginning with a dollar sign. Both make it easy to display the results of the calculations and the variables.
Key points
- Console.WriteLine print the text and move to new line; Console.Write remains on the same line.
- The placeholder {0}, {1} is filled by the following argument or by string.Format.
- String interpolation uses the dollar sign so that the variable can be written directly into the quotation marks.
- The output does not have to be fixed text; the result of the expression and the value of the variable can also be printed.
- Console.Clear() is used when you want to clean the console screen first.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.