C-SHARP - 1.5 Exercise: Display

Hello everyone and welcome to this new video. After theory, it's time for practice I'll give you a little exercise to do. We saw how to display things in the exit window. Now I would like you to show me in the exit window "Hello, it's very nice today" On a line but twice. I will explain to you. Basically "Hello," and "it's very nice today" will not be in the same function But on the exit window there must be displayed Hello, It's very nice today on a single line no return to the line between "Hello" and "it's very nice today". And then you will have to display below this sentence, on the line "Yes indeed, It's a time to go play sports." This is the exercise you have to do. Pause the video and in a moment, We meet again for the correction. So let's go On your marks! Ready! Code! We are now coming together for the correction of the exercise, I hope you have succeeded. So let's go for the correction. The purpose of this exercise was to display "Hello, The weather is nice today." On a single line, however, in two different functions. For this, you remember in the previous video I told you about two functions Console. WriteLine(); Which allows you to display in the output window what is passed to it as a parameter and returns to the line at the end. What we pass in parentheses is called a parameter, remember this notion because it will be used later. To return, we saw together another function that does not return to the line. When we go to display something, And that if behind we re-display a sentence, It will overlap with the one we displayed just before. And this function: it's Console.Write(); So here what had to be done for the first instruction: We had to write "Console.Write("Hello,") and at the end we put one; Then you go back to the line and write Console.WriteLine ("it's very nice today") ; at the end If you click on the play button, We can see that "Hello, he Is very nice today" is displayed on a single line with two different functions. Small indications on the code: You see that here I put a space after the comma Indeed, if I don't put space, The program will directly display the sentences on top of each other I'm going to remove the space and I'll press the play button and you see? He pasted the 2 sentences. A computer performs the tasks it is asked to do without thinking He's not going to say ah well I'm going to concatenate 2 channels I'm going to automatically put a space. That's why That afterwards when you go to make programs with strings and concatenate them with other strings, Don't forget the spaces. Then another indication, why here I didn't put Console.Write simple but Rather Console.WriteLine I think you guessed? Indeed, it is to directly anticipate the 2nd instruction which was to display on the line "Yes indeed, It's a time to go play sports." So then To continue I can use one of the 2 functions, I'm going to write Console. WriteLine(« Yes indeed, It's a time to play sports") and don't forget it; at the end I click on the play button and we have in the exit window "Yes indeed, it's a time to play sports." That's all for this exercise. In any case, I hope you succeeded and that you liked this video. I'll tell you right away in future videos.