Why is the following not showing up as depicted on the course?

Magic Paul 0 Reputation points
2024-04-25T12:43:21.6466667+00:00

I entered the code, as instructed: Console.Write("Congratulations!");

Console.Write(" ");

Console.Write("You wrote your first lines of code.");

The output was all on the same line: "Congratulations! You wrote your first lines of code.", however, according to the course, it should not have been.

In order to get it on separate lines I had to use Console.WriteLine every time.

I just want to make sure I understand this properly before moving on.

Please see attached picture.20240425_132636

This question is related to the following Learning Module

Azure | Azure Training
{count} votes

2 answers

Sort by: Most helpful
  1. TP 126.2K Reputation points Volunteer Moderator
    2024-04-25T12:50:59.7033333+00:00

    Hi Paul,

    The output you got is correct. The Output shown in the exercise is wrong. It should have it all on one line.

    See this excerpt from the exercise text:

    To print to the output console, but without adding a line feed at the end, you used the second technique, Console.Write(). So, the next call to Console.Write() prints another message to the same line.

    Please click Accept Answer and upvote if the above was helpful.

    Thanks.

    -TP

    0 comments No comments

  2. Pradeep M 9,775 Reputation points Microsoft External Staff Volunteer Moderator
    2024-04-25T12:52:59.4266667+00:00

    Hi Magic Paul

    Thank you for reaching out to Microsoft Q & A forum.  

    Where is this information being displayed? 

    Learning Path: https://learn.microsoft.com/en-us/training/paths/get-started-c-sharp-part-1/ 

    Module: https://learn.microsoft.com/en-us/training/modules/csharp-write-first/ 

    Unit: 2 - https://learn.microsoft.com/en-us/training/modules/csharp-write-first/2-exercise-hello-world

    After discussing with the content author, they have confirmed that the Learn paths will undergo revision and updates in the forthcoming major update, which is expected soon. 

    We believe this information is helpful to you! If so, please acknowledge it by clicking "Accept Answer" and "Upvote" on the post. 

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.