HOW TO PROGRAM - Getting Started!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you want to learn how to program but don't know where to start this video should help point you in the right direction the world of programming can be a large and confusing place but let's try and break it down i find that lots of people who have never tried to program before think of it as one skill being a programmer means how to do one thing however the truth is pretty far from that there are many different programming languages and ways to program so this brings us to the first decision an aspiring programmer has to make what language do i start with and the answer is well it depends there are a lot of languages to choose from and each have their own strengths and weaknesses but most importantly what language is right for you is going to completely depend on what you want to make for this series i've chosen to go with c sharp no not that c sharp this c sharp now some of you might know that i'm a bit biased here after all our entire youtube channel is built around game development and the most popular game engine today unity uses c-sharp as its programming language but i do believe that c-sharp is a great starting point for most developers this is not because it does everything perfectly no language does but because of its diversity you see c-sharp is a widely used programming language it can be used to develop for mobile pc mac and even the web and if you want to get into game development you can get started with unity right away it's also based on c which makes it really similar to other popular languages like c c plus plus and java so if you later want to pick up another programming language chances are that the transition won't be too difficult so in this short series you will learn how to get started programming in c sharp and make your first programs the videos are going to focus on the absolute basics so whether you want to make video games or web apps you should be able to apply everything right away but before we get coding this video is sponsored by jason wyman sometimes when learning new skills like coding it can be hard to find the motivation to learn by yourself in this case joining a course alongside other students and with live help from a teacher can be a better choice jason has made an awesome course on game architecture which will teach you how to write clean and proper game code you'll have access to live help from jason himself and a discord channel where you can chat with your fellow students this will also give you access to the game dev mastery course which will teach you how to create a variety of game types in unity so make your first game by signing up now simply click the link in the description now once we've chosen the language we want to write in we need to pick a code editor many modern code editors will not only allow us to write code but also help with debugging and building our program you'll see some of these referred to as an ide or integrated development environment but don't let that scary title throw you off of course there are a lot of code editors to choose from and most of the time it's a matter of personal preference in this series we're going to be using visual studio code vs code is microsoft's lightweight code editor it's great because it can be used to program in almost any language it's multi-platform open source and it's 100 free now in this series we're going to be creating a console application if you don't know what that is here's one i agree with you that it does not look very appealing but it's great for learning how to program since it allows us to focus on the language itself without too many distractions but creating any kind of software completely from scratch is a huge challenge instead we normally use what is called a framework for now you can think of a framework like a toolbox with a bunch of tools inside that will help you accomplish your job better and faster it's kind of the foundation that we build our program on top of we're going to use the dotnet framework this is also created by microsoft and it can be used to create pretty much any kind of application so don't worry you don't need to understand exactly what a framework is just know that we need one for now and with that explanation in mind let's get net and vs code set up and run our first program get it i ran a program that's really bad so the first thing that we want to do is install the.net core i'll of course have a link to this in the description simply follow that link select your platform and hit install then simply follow the installation instructions that you see on the screen it should be pretty straightforward once you're done we can simply hit close and next up we want to install visual studio code again i'll of course have a link for this in the description simply download and follow the installation screen and once it's done we can go ahead and open up visual studio code now vs code by default is really lightweight and it doesn't have the necessary tools for us to start writing in c-sharp instead we need to install this as an extension so let's go to the bottom icon in the left hand side and here we can go ahead and search for c sharp let's select the first one as we can see c sharp by microsoft and let's simply go ahead and hit install and once it's finished we're ready to start writing c sharp however there are actually a lot of really cool extensions available here one that i personally like is the vs code icons so i'm going to search for icons here and select the vs code icons and install it it then prompts me to select it as an icon theme here which i'm gonna do you can also hit this button right here and all this does is just add some nice user-friendly icons to all of our files and with that we can go ahead and close down this page and go to the top icon here and we're now ready to create our first project so to do that let's go to our desktop here let's create a folder that is going to store our project i'm going to call it my awesome program and right now this is of course completely empty so let's go ahead and fill this up with a project to do that we go inside of vs code we hit open folder we navigate to the my awesome program folder and hit select and as we can see it's now opened up in vs code but of course it's still completely empty so let's create a new project in here to do that we go to terminal at the top here and create a new terminal this is a command line interface that allows us to call certain commands and as you can see here we're currently inside of the my awesome program folder on my desktop so we can go ahead and call a command in here called net space new in order to create a new project here and we're then going to type console in order to use the simple console template let's hit enter and as you can see this creates some files in our project the most important one is the program.cs file this is the meat of our program and it's where we're going to write our first lines of code now for some of you the font size might be very small by default so to change this we can go up to view and open up the command palette you can also press ctrl shift p and what this allows us to do is search through all kinds of commands in our case we want to change some user settings so let's simply search for user settings and indeed here we can open the preferences and go under user settings and right here we can change the font size now i'm just going to set this to something like 24 and i'm also going to search at the top here for code lens and here where it says editor code lens i'm going to disable that what this does is it overlays some extra information on top of your code and i find that's a bit confusing for a beginner so i recommend just turning this off and that's it for our setup now we're not going to get into the code itself in this video instead i'll just quickly show you how to run your program as you're going to be doing that a lot now if we look at our code here we can see that by default there's a bit in here and this might look really scary but for now we can ignore everything except this line right here this line writes out the words hello world in our console so if we run our program now it should simply display hello world to run our program we can go to our terminal and type net space run and hit enter and indeed it says hello world but typing in this command every time we want to run our code is a bit annoying instead we can tell vs code how to run our program let's again press ctrl shift p to open up the command palette let's search for generate and select dot net generate assets for build and debug and as you can see this creates two new files in our program folder launch and tasks these files tell vs code how to run our code while we're working on the program by default these are set up correctly except that we want our program to open in a new window when we run it instead of just having it down here in the internal console so to change this we go into our launch.json file and look for a property called console and we're simply going to change this from internal console to external terminal with a non-capital e and a capital t now if we save this and go to our program we can actually run our code by simply going run start debugging and what you'll see here is a bunch of things happening you will see some things flashing on your screen you will see things printed in the debug console and you might even see a window quickly open and then close immediately and the reason for this is not that our program didn't run it did actually start but it also closed as soon as the program was finished and right now it's finished as soon as it said hello world so we didn't even really get a chance to see it so to fix this let's add a line underneath here so i'm going to add a new line here and this line here is going to tell our program to wait for some input before closing for now we can just write after me i'm going to type console dot read key and remember capitalization is important here open and close parenthesis and a semicolon so this line is simply going to say hey we're going to wait for any kind of input from our keyboard this way if we save this and go run our program so we'll go to run start debugging or you can simply press f5 we can indeed see that it opens up it displays hello world and when we then press a key i'm just going to press the space bar here the program is finished and it closes automatically awesome so that's our first program and that's pretty much it for this video if you enjoyed it make sure to subscribe and ring that notification bell so you don't miss the next one in the next video we're going to start writing some code also don't forget to check out jason's course on game architecture learn how to write clean game code by simply clicking the link in the description and get the game dev mastery course included for free on that thanks for watching and i will see you in the next video thanks to the awesome patreon supporters who donated in april and a special thanks to dash blank lost to violent stuff forever face amerifi john replica studios srt mike lula set jason eutesco knobby ninja willie tannen daniel desanik donatine gascoigne danta sam jacob sanford nawki wasaki mogan throne giard gregory pierce michael korobov the mighty zeus owen cooper alice in the fierce erasmus and sirius you guys rock
Info
Channel: Brackeys
Views: 1,496,581
Rating: undefined out of 5
Keywords: brackeys, unity, unity3d, beginner, easy, how, to, howto, learn, course, series, tutorial, tutorials, game, development, develop, games, programming, coding, basic, basics, C#, code, VSCode, visual, studio, console, getting, started, first, new, program, software, setup, syntax, classes, methods, functions, install, framework, C++, Java, C sharp, language, choose, which programming language
Id: N775KsWQVkw
Channel Id: undefined
Length: 10min 36sec (636 seconds)
Published: Sun Jun 07 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.