User:CodingBot02/C Sharp Tutorial/Printing Text

Displaying Output Most applications require some input from the user and give output as a result. To display text to the console window you use the Console.Write or Console.WriteLine methods. The difference between these two is that Console.WriteLine is followed by a line terminator, which moves the cursor to the next line after the text output. The program below will display Hello World! to the console window: Note the parentheses after the WriteLine method. This is the way to pass data, or arguments, to methods. In our case WriteLine is the method and we pass "Hello World!" to it as an argument. String arguments must be enclosed in quotation marks. We can display variable values to the console window: To display a formatted  string , use the following syntax: As you can see the value of x replaced {0} and the value of y replaced {1}. You can have as many variable placeholders as you need (i.e.: {3}, {4}, etc.).