Writing to Console

Writing to Console

Console.WriteLine means to tell the computer to print the sentence enclosed within the parentheses () out onto the console.

Working Together

  1. In the Replit program below, press run. You see that Hello World is printed out to the screen on the right.
  2. Without removing the quotation marks, try changing "Hello World" to another sentence. Press run to see if anything changes.
  3. Add another Console.WriteLine below the current line to print a second sentence below the first sentence.
  4. Press run to see if two sentences are printed out. If you see any red text, please ask for help.

Launch Replit

We will use printing heavily in the later lessons, so make sure you understand this before continuing!

HELP! I got a lot of red text!

If you see any red text, you have encountered some errors! Please ask for help or check the debugging page at the end of this tutorial. Beware of the following when coding in C#:

  1. The c in Console, and the w and l in WriteLine are capitalized.
  2. There is a semicolon ; at the end of the line.
  3. Make sure the sentence you wish to print is surrounded in quotation marks, and that the sentence is between the parentheses.
  4. Do not delete any curly braces { or }.