1 00:00:06,420 --> 00:00:08,111 Hello, and welcome to How To: Beginner Programming, 2 00:00:08,111 --> 00:00:10,799 a multi-part guide to your first steps in the world of programming 3 00:00:10,799 --> 00:00:12,799 In these following episodes, I'll be demonstrating 4 00:00:12,799 --> 00:00:15,018 the basic principles of programming, 5 00:00:15,018 --> 00:00:16,984 from creating your first application, 6 00:00:16,984 --> 00:00:19,362 to developing your own objects. 7 00:00:19,362 --> 00:00:23,011 Now, don't worry yet if you have no idea what any of those are, 8 00:00:23,011 --> 00:00:24,175 we'll get to that. 9 00:00:24,175 --> 00:00:26,858 In the first episode, I'll demonstrate how to set up your 10 00:00:26,858 --> 00:00:29,269 programming environment, or "workbench", 11 00:00:29,269 --> 00:00:31,233 and run a simple 'hello world' command, 12 00:00:31,233 --> 00:00:32,794 commenting on each step throughout 13 00:00:32,794 --> 00:00:34,298 so you guys know what's going on. 14 00:00:34,298 --> 00:00:35,297 First things first: 15 00:00:35,297 --> 00:00:38,364 You'll need an environment to work in, as well as a language to use. 16 00:00:38,364 --> 00:00:40,524 Now, this is entirely up to preference, 17 00:00:40,524 --> 00:00:43,554 but I'll be using Visual Studio Express, which is available for free. 18 00:00:43,554 --> 00:00:52,277 I'll leave a link in the description. 19 00:00:52,277 --> 00:00:54,651 It's available from the website for free, 20 00:00:54,651 --> 00:00:57,093 and I'll be using C# (pronounced "see sharp") to program. 21 00:00:57,093 --> 00:00:59,841 I suggest those of you who have no idea what you're doing, 22 00:00:59,841 --> 00:01:01,529 or are first-time learners, 23 00:01:01,529 --> 00:01:03,407 also follow along in C#. 24 00:01:03,407 --> 00:01:06,965 Otherwise it might get confusing with syntax. 25 00:01:06,965 --> 00:01:10,061 Once you've got it downloaded and installed, 26 00:01:10,061 --> 00:01:14,626 open it up and start a new project. 27 00:01:14,626 --> 00:01:19,688 Now, this will display three basic programming languages. 28 00:01:19,688 --> 00:01:22,284 Visual Basic, which I would not recommend, 29 00:01:22,284 --> 00:01:28,313 is good for beginners, but it's a bit too simplistic, 30 00:01:28,313 --> 00:01:29,940 and not pretty to use, either. 31 00:01:29,940 --> 00:01:35,569 Visual C++, which I would not recommend for beginners, 32 00:01:35,569 --> 00:01:38,407 because you have to worry about so much [more than C#]. 33 00:01:38,407 --> 00:01:41,229 For a simple 'hello world' program, C++ is simple enough, 34 00:01:41,229 --> 00:01:43,577 but when you get to more stuff it gets a bit more complicated, 35 00:01:43,577 --> 00:01:44,767 especially with arrays. 36 00:01:44,767 --> 00:01:46,671 Again, we'll get to that in due time, 37 00:01:46,671 --> 00:01:50,453 but for now we'll be using C#. 38 00:01:50,453 --> 00:01:52,203 Start a console application. 39 00:01:52,203 --> 00:01:55,362 Now this is just a basic "black box window" that pops up, 40 00:01:55,362 --> 00:01:59,861 and you can input and output text to it. 41 00:01:59,861 --> 00:02:03,489 I'll be calling it "HelloWorld" 42 00:02:03,489 --> 00:02:05,146 because that's what we're going to be doing with it: 43 00:02:05,146 --> 00:02:06,800 outputting "hello world" to the screen... 44 00:02:06,800 --> 00:02:09,300 exciting stuff! 45 00:02:09,300 --> 00:02:13,149 This has created the project, as well as a "main" method. 46 00:02:13,149 --> 00:02:16,246 This is where all of the code we're going to write 47 00:02:16,246 --> 00:02:19,523 will be ran from. 48 00:02:19,523 --> 00:02:21,590 Every application has one of these ["main" methods]. 49 00:02:21,590 --> 00:02:23,339 Whenever you run an application, 50 00:02:23,339 --> 00:02:27,341 it will look for the "main" method and run whatever is inside. 51 00:02:27,341 --> 00:02:29,906 It will continue throughout until it reaches the endpoint. 52 00:02:29,906 --> 00:02:31,878 For the purpose of the first video, 53 00:02:31,878 --> 00:02:34,938 we're just outputting a message to the console window. 54 00:02:34,938 --> 00:02:35,880 To do this, we write 55 00:02:35,880 --> 00:02:41,177 "Console.WriteLine()" 56 00:02:41,177 --> 00:02:46,398 and then whatever message you want inside here. 57 00:02:46,398 --> 00:02:47,521 For the purpose of this, again, 58 00:02:47,521 --> 00:02:50,122 "Hello World!" 59 00:02:50,122 --> 00:02:53,029 Whenever you're starting a new language, 60 00:02:53,029 --> 00:02:57,688 you can usually find a "Hello world" example, 61 00:02:57,688 --> 00:02:59,253 to show you the syntax [of the language]. 62 00:02:59,253 --> 00:03:07,096 So this is accessing the "Console". 63 00:03:07,096 --> 00:03:11,821 And using the method, "WriteLine". 64 00:03:11,821 --> 00:03:15,168 And passing the value, "Hello World!". 65 00:03:15,168 --> 00:03:21,633 Now, every line you write, in most languages, 66 00:03:21,633 --> 00:03:24,388 you have to put a semicolon at the end 67 00:03:24,388 --> 00:03:27,637 as if to say, "That's the end of the line. No more on this line." 68 00:03:27,637 --> 00:03:31,542 Otherwise, (showing an example)... 69 00:03:31,542 --> 00:03:42,702 the program won't know what to do. 70 00:03:42,702 --> 00:03:46,202 Once we've written this, we need a 71 00:03:46,202 --> 00:03:48,733 "Console.ReadLine()" 72 00:03:48,733 --> 00:03:50,890 which stops the program from closing, 73 00:03:50,890 --> 00:03:54,547 so the user has time to actually read the message, "Hello World!" 74 00:03:54,547 --> 00:03:59,451 If we ran the program without "Console.ReadLine()"... 75 00:03:59,451 --> 00:04:07,609 it will just open up and instantly close! 76 00:04:07,609 --> 00:04:14,458 So we use "Console.ReadLine()", or "Console.Read()" 77 00:04:14,458 --> 00:04:18,424 to stop it from closing so we have time to read it. 78 00:04:18,424 --> 00:04:21,648 All "Console.ReadLine()" does is it waits for the user 79 00:04:21,648 --> 00:04:24,396 to input any text and then press enter. 80 00:04:24,396 --> 00:04:29,304 When enter is pressed, the value is passed into the "Console.ReadLine()", 81 00:04:29,304 --> 00:04:34,615 and if we had something here, like (example)... 82 00:04:34,615 --> 00:04:40,933 The variable will be assigned the value of the user's input. 83 00:04:40,933 --> 00:04:42,433 For now, don't worry about that; 84 00:04:42,433 --> 00:04:45,214 we're just displaying "Hello World!" to the screen, like this... 85 00:04:45,214 --> 00:04:52,903 Press enter when you're done. 86 00:04:52,903 --> 00:04:57,662 That's it for a "Hello world"! 87 00:04:57,662 --> 00:05:00,098 That's part one of, "How To: Beginner Programming". 88 00:05:00,098 --> 00:05:01,877 Further parts will be released shortly, 89 00:05:01,877 --> 00:05:05,537 but I'll leave a gap between videos to allow you to ask questions, 90 00:05:05,537 --> 00:05:08,067 and I'll answer them at the start of the following part. 91 00:05:08,067 --> 00:05:12,514 The gap between the first and second episodes won't be too long. 92 00:05:12,514 --> 00:05:19,825 Maybe do a bit of research before the next episode, 93 00:05:19,825 --> 00:05:25,548 so you're a bit ahead of everything, 94 00:05:25,548 --> 00:05:29,577 and any assumptions I accidentally make will make sense to you. 95 00:05:29,577 --> 00:05:33,711 Thanks for watching, and leave any questions in the comment section below, 96 00:05:33,711 --> 00:05:36,558 and I'll try to answer them at the start of the next episode. 97 00:05:39,961 --> 00:05:41,207 Thanks for watching! 98 00:05:43,054 --> 00:05:43,992