WEBVTT 00:00:06.420 --> 00:00:08.111 Hello, and welcome to How To: Beginner Programming, 00:00:08.111 --> 00:00:10.799 a multi-part guide to your first steps in the world of programming 00:00:10.799 --> 00:00:12.799 In these following episodes, I'll be demonstrating 00:00:12.799 --> 00:00:15.018 the basic principles of programming, 00:00:15.018 --> 00:00:16.984 from creating your first application, 00:00:16.984 --> 00:00:19.362 to developing your own objects. 00:00:19.362 --> 00:00:23.011 Now, don't worry yet if you have no idea what any of those are, 00:00:23.011 --> 00:00:24.175 we'll get to that. 00:00:24.175 --> 00:00:26.858 In the first episode, I'll demonstrate how to set up your 00:00:26.858 --> 00:00:29.269 programming environment, or "workbench", 00:00:29.269 --> 00:00:31.233 and run a simple 'hello world' command, 00:00:31.233 --> 00:00:32.794 commenting on each step throughout 00:00:32.794 --> 00:00:34.298 so you guys know what's going on. 00:00:34.298 --> 00:00:35.297 First things first: 00:00:35.297 --> 00:00:38.364 You'll need an environment to work in, as well as a language to use. 00:00:38.364 --> 00:00:40.524 Now, this is entirely up to preference, 00:00:40.524 --> 00:00:43.554 but I'll be using Visual Studio Express, which is available for free. 00:00:43.554 --> 00:00:52.277 I'll leave a link in the description. 00:00:52.277 --> 00:00:54.651 It's available from the website for free, 00:00:54.651 --> 00:00:57.093 and I'll be using C# (pronounced "see sharp") to program. 00:00:57.093 --> 00:00:59.841 I suggest those of you who have no idea what you're doing, 00:00:59.841 --> 00:01:01.529 or are first-time learners, 00:01:01.529 --> 00:01:03.407 also follow along in C#. 00:01:03.407 --> 00:01:06.965 Otherwise it might get confusing with syntax. 00:01:06.965 --> 00:01:10.061 Once you've got it downloaded and installed, 00:01:10.061 --> 00:01:14.626 open it up and start a new project. 00:01:14.626 --> 00:01:19.688 Now, this will display three basic programming languages. 00:01:19.688 --> 00:01:22.284 Visual Basic, which I would not recommend, 00:01:22.284 --> 00:01:28.313 is good for beginners, but it's a bit too simplistic, 00:01:28.313 --> 00:01:29.940 and not pretty to use, either. 00:01:29.940 --> 00:01:35.569 Visual C++, which I would not recommend for beginners, 00:01:35.569 --> 00:01:38.407 because you have to worry about so much [more than C#]. 00:01:38.407 --> 00:01:41.229 For a simple 'hello world' program, C++ is simple enough, 00:01:41.229 --> 00:01:43.577 but when you get to more stuff it gets a bit more complicated, 00:01:43.577 --> 00:01:44.767 especially with arrays. 00:01:44.767 --> 00:01:46.671 Again, we'll get to that in due time, 00:01:46.671 --> 00:01:50.453 but for now we'll be using C#. 00:01:50.453 --> 00:01:52.203 Start a console application. 00:01:52.203 --> 00:01:55.362 Now this is just a basic "black box window" that pops up, 00:01:55.362 --> 00:01:59.861 and you can input and output text to it. 00:01:59.861 --> 00:02:03.489 I'll be calling it "HelloWorld" 00:02:03.489 --> 00:02:05.146 because that's what we're going to be doing with it: 00:02:05.146 --> 00:02:06.800 outputting "hello world" to the screen... 00:02:06.800 --> 00:02:09.300 exciting stuff! 00:02:09.300 --> 00:02:13.149 This has created the project, as well as a "main" method. 00:02:13.149 --> 00:02:16.246 This is where all of the code we're going to write 00:02:16.246 --> 00:02:19.523 will be ran from. 00:02:19.523 --> 00:02:21.590 Every application has one of these ["main" methods]. 00:02:21.590 --> 00:02:23.339 Whenever you run an application, 00:02:23.339 --> 00:02:27.341 it will look for the "main" method and run whatever is inside. 00:02:27.341 --> 00:02:29.906 It will continue throughout until it reaches the endpoint. 00:02:29.906 --> 00:02:31.878 For the purpose of the first video, 00:02:31.878 --> 00:02:34.938 we're just outputting a message to the console window. 00:02:34.938 --> 00:02:35.880 To do this, we write 00:02:35.880 --> 00:02:41.177 "Console.WriteLine()" 00:02:41.177 --> 00:02:46.398 and then whatever message you want inside here. 00:02:46.398 --> 00:02:47.521 For the purpose of this, again, 00:02:47.521 --> 00:02:50.122 "Hello World!" 00:02:50.122 --> 00:02:53.029 Whenever you're starting a new language, 00:02:53.029 --> 00:02:57.688 you can usually find a "Hello world" example, 00:02:57.688 --> 00:02:59.253 to show you the syntax [of the language]. 00:02:59.253 --> 00:03:07.096 So this is accessing the "Console". 00:03:07.096 --> 00:03:11.821 And using the method, "WriteLine". 00:03:11.821 --> 00:03:15.168 And passing the value, "Hello World!". 00:03:15.168 --> 00:03:21.633 Now, every line you write, in most languages, 00:03:21.633 --> 00:03:24.388 you have to put a semicolon at the end 00:03:24.388 --> 00:03:27.637 as if to say, "That's the end of the line. No more on this line." 00:03:27.637 --> 00:03:31.542 Otherwise, (showing an example)... 00:03:31.542 --> 00:03:42.702 the program won't know what to do. 00:03:42.702 --> 00:03:46.202 Once we've written this, we need a 00:03:46.202 --> 00:03:48.733 "Console.ReadLine()" 00:03:48.733 --> 00:03:50.890 which stops the program from closing, 00:03:50.890 --> 00:03:54.547 so the user has time to actually read the message, "Hello World!" 00:03:54.547 --> 00:03:59.451 If we ran the program without "Console.ReadLine()"... 00:03:59.451 --> 00:04:07.609 it will just open up and instantly close! 00:04:07.609 --> 00:04:14.458 So we use "Console.ReadLine()", or "Console.Read()" 00:04:14.458 --> 00:04:18.424 to stop it from closing so we have time to read it. 00:04:18.424 --> 00:04:21.648 All "Console.ReadLine()" does is it waits for the user 00:04:21.648 --> 00:04:24.396 to input any text and then press enter. 00:04:24.396 --> 00:04:29.304 When enter is pressed, the value is passed into the "Console.ReadLine()", 00:04:29.304 --> 00:04:34.615 and if we had something here, like (example)... 00:04:34.615 --> 00:04:40.933 The variable will be assigned the value of the user's input. 00:04:40.933 --> 00:04:42.433 For now, don't worry about that; 00:04:42.433 --> 00:04:45.214 we're just displaying "Hello World!" to the screen, like this... 00:04:45.214 --> 00:04:52.903 Press enter when you're done. 00:04:52.903 --> 00:04:57.662 That's it for a "Hello world"! 00:04:57.662 --> 00:05:00.098 That's part one of, "How To: Beginner Programming". 00:05:00.098 --> 00:05:01.877 Further parts will be released shortly, 00:05:01.877 --> 00:05:05.537 but I'll leave a gap between videos to allow you to ask questions, 00:05:05.537 --> 00:05:08.067 and I'll answer them at the start of the following part. 00:05:08.067 --> 00:05:12.514 The gap between the first and second episodes won't be too long. 00:05:12.514 --> 00:05:19.825 Maybe do a bit of research before the next episode, 00:05:19.825 --> 00:05:25.548 so you're a bit ahead of everything, 00:05:25.548 --> 00:05:29.577 and any assumptions I accidentally make will make sense to you. 00:05:29.577 --> 00:05:33.711 Thanks for watching, and leave any questions in the comment section below, 00:05:33.711 --> 00:05:36.558 and I'll try to answer them at the start of the next episode. 00:05:39.961 --> 00:05:41.207 Thanks for watching! 00:05:43.054 --> 00:05:43.992