1 00:00:00,940 --> 00:00:02,050 Welcome back. 2 00:00:02,050 --> 00:00:03,390 How did it go? 3 00:00:03,390 --> 00:00:06,610 Don't worry if you weren't able to complete every to do. 4 00:00:06,610 --> 00:00:09,910 It's not unusual to struggle when learning something new. 5 00:00:09,910 --> 00:00:11,794 Let's walk through how I implemented each to do. 6 00:00:15,907 --> 00:00:19,788 For the first to do, I declared a string variable named thing, and 7 00:00:19,788 --> 00:00:22,924 initialized it to the string literal value, movie. 8 00:00:27,831 --> 00:00:31,722 For the second to do, I used the Console.Write method to output the string 9 00:00:31,722 --> 00:00:34,150 literal, what is your name, to the console. 10 00:00:35,870 --> 00:00:40,800 Then I made a call to the Console.ReadLine method to prompt the user for their value. 11 00:00:40,800 --> 00:00:43,067 The ReadLine method returns a string, so 12 00:00:43,067 --> 00:00:45,997 I capture that value in a string variable named name. 13 00:00:48,600 --> 00:00:52,084 Using the Write method here, instead of the WriteLine method, 14 00:00:52,084 --> 00:00:56,030 means that the user will input their value on the same line as the prompt. 15 00:00:57,420 --> 00:01:00,240 Also, notice this space after the question mark. 16 00:01:01,760 --> 00:01:04,008 Adding the space is totally optional, but 17 00:01:04,008 --> 00:01:07,692 I find that it helps the formatting in the console to have a little bit of 18 00:01:07,692 --> 00:01:10,642 breathing room between the prompt text and the cursor. 19 00:01:18,140 --> 00:01:21,332 For the third to do, I use the Console.Write method again 20 00:01:21,332 --> 00:01:25,584 to output the string literal, what is your favorite thing, to the console. 21 00:01:27,319 --> 00:01:31,674 This time, I concatenated the string literals, what is your favorite, and 22 00:01:31,674 --> 00:01:34,091 question mark, with the thing variable. 23 00:01:36,381 --> 00:01:41,577 Then I made a call to the Console.ReadLine method to prompt the user for their value, 24 00:01:41,577 --> 00:01:46,642 and capture the method's return value in a string variable named favoriteThing. 25 00:01:51,275 --> 00:01:53,066 For the fourth and last to do, 26 00:01:53,066 --> 00:01:57,960 I used the Console.WriteLine method to output a message to the console. 27 00:01:57,960 --> 00:02:02,150 Again, using string concatenation to combine string literals and 28 00:02:02,150 --> 00:02:03,170 variable values. 29 00:02:05,588 --> 00:02:09,120 Using the WriteLine method here instead of the Write method 30 00:02:09,120 --> 00:02:12,880 ensures that the message is written to its own line in the console. 31 00:02:12,880 --> 00:02:14,770 So when the program terminates, 32 00:02:14,770 --> 00:02:18,620 the console prompt will be displayed on the line below the message. 33 00:02:20,330 --> 00:02:22,030 Be sure to save the file. 34 00:02:22,030 --> 00:02:26,094 You can do that pressing Ctrl+S or Cmd+S on the Mac, or 35 00:02:26,094 --> 00:02:28,610 select the File > Save menu item. 36 00:02:33,390 --> 00:02:36,240 Now let's compile and run our program. 37 00:02:36,240 --> 00:02:39,306 Show the console by selecting the View > Show Console menu item. 38 00:02:44,265 --> 00:02:50,150 Run the command mcs Program.cs. 39 00:02:50,150 --> 00:02:57,940 Then we can run the program using the command mono Program.exe. 40 00:02:57,940 --> 00:03:02,948 Here's the prompt asking me for my name and my favorite movie. 41 00:03:02,948 --> 00:03:07,290 And here is the message, 42 00:03:07,290 --> 00:03:11,128 my name is James and my favorite movie is Toy Story, written to the console. 43 00:03:11,128 --> 00:03:13,190 And that`s it. 44 00:03:13,190 --> 00:03:15,030 Keep practicing, and we`ll see you next time.