BrandGhost

Learning How To Program - Zero Experience Required!

I'm Nick Cosentino, and I'm an engineering manager at Microsoft. I believe that programming is one of the most important skills you can have access to, and I'm here to help you get started. Does this sound like you? - "I can't program, I'm no good at math" - "I'm not smart enough to write code" - "I don't know where to start" - "I don't even know what language to use" - "I don't see any value in it" - "It's too hard" If so, I'm here to help. If not, maybe I just missed your own personal excuse...
View Transcript
foreign so yeah um what I was rambling about when you couldn't hear me was just that um I am an engineering manager and I've been trying to do sessions like this and different variations right so I can see in the chat uh Francisco's joined so um Francisco is actually someone I work with and I think today's topic of conversation is probably going to be a lot more introductory than maybe what Francisco and I would talk about at work but thanks anyway for tuning in Francisco that's awesome to see you what I'd like to go over today though is basically spending time with folks to help you be introduced to programming and not necessarily have you leaving this you know hour-long session where you feel like hey I can go build you know the next billion dollar startup or something like that um it's not it's not something that you just learn instantly it does take practice but um I think one of the big challenges is that people seem to be nervous about getting started right it seems if you're not in a technical space it kind of seems a little bit scary perhaps so you know where do you get started there's so much information on the internet I don't have time um you know there's so many excuses you'll hear right and I think that's okay but I think you have to get started so one thing I'll hopefully debunk today is that you don't need to be strong in math to to be um you know interested or try out programming for what it's worth I would say very early on in my programming journey I would consider myself strong in math like in high school um awesome yeah so in in high school I think I was good at math but then like I would not say that I have any interest in math in my my 30s or even in my 20s um so I program regularly and if I can program regularly and feel like I'm not great at math you can do it too um so where are we going to start so I guess I was mentioning why I wanted to do this right it's to get people exposed to how you can just try to get into programming without hopefully having too many barriers where you feel like you just can't get started that's going to be the main thing and again it's not you're going to leave this knowing everything about programming and for what it's worth I would say after this if you're checking out other resources if you're seeing videos and links on social media where people are basically promising you like oh watch this quick video and you'll be an expert after it's just not reality so I want you to have real expectations it's just like learning any other skill and I would say honestly think about like learning a new language um I only speak English and I had a little bit of French exposure uh you know early in my life but I could not speak French now right and if you tried to learn a new language you're going to have to spend time practicing it it just doesn't happen instantly so please have a realistic expectations don't beat yourself up if you're finding it a little bit challenging just stick with it and practice okay so the first thing I wanted to go into um and it's not just writing code the first thing I want to talk about is like what is a program right so I think a lot of the time especially because people think about if you're not familiar with programming like the go-to is that you know which programs are for computers it's going to be a lot of ones and zeros um I don't know how to speak ones and zeros how could I ever be a programmer um that would never work for me and I wanted to start by saying that like when we're thinking about programs the what I would say is the average programmer is also not thinking about programs in ones and zeros um so I want to kind of clarify that in the first place right when we're talking about programs we're not as programmers we don't sit at our desks and go hmm I wonder how I would think about this logic that I want to write and speak it in ones and zeros to a machine so that it knows how to do it and we can be very thankful that there have been many years of developments in software engineering to do that work for us so what do I mean by that well at the lowest level when we're talking about computers yes they are dealing with ones and zeros right it's a lot of switches on and off um you've probably heard binary right um but we don't have to think about that as programmers today which is great there are some really low level things you could do in programming where that becomes a lot more um kind of in your face because some of the things you're doing maybe you're talking um you're writing software that has to do with different pieces of Hardware right like you might have a circuit board and some other stuff that you're trying to interface with that might be something where you're genuinely looking at moving around ones and zeros but it's pretty specific and even then there's going to be software that's been built on top of that where you don't have to think about how that works so how do we go from like the ones and zeros at the very low level that I'm telling you you don't have to worry about how do we go from you know computers talk that way to we're speaking like I'm speaking English to you um how do we go from thoughts and logic that we can understand too what a computer is going to understand and execute for you well there's a lot of different ways that this happens but I mean the generalized way to look at it is that there's different tools that we can use as programmers um and one word you'll hear come up is compiling so it can take code that you write right as programmers we're going to be writing code and it will convert that into something that a processor so a computer can actually understand and execute for you so the point is that there's tools and there's generally many layers of tools that will do different conversions that you don't have to think about fortunately um into something that the computer can understand now as I'm telling you this there's absolutely situations where um you know depending on your field of programming you might be spending actually a lot more time having to think about those things but I would say the average programmer um like just generally doesn't have to worry too much about that if all of the tools and pieces are built well for you you can think about how you want to take your thoughts and your logic and turn that into code that then a machine will interpret later for you okay so I'm not gonna if other people are watching this and they're more advanced they might find like you know as I'm saying this like well Nick you know there's compiled code there's interpreted code there's all these different languages and different processor architectures like we're not getting into that I don't think it's you know necessary for people when they're getting started I think that's probably something that would scare people away so what I want to talk about is just you know the easier parts that are more simple to understand so when we think about writing programs a lot of it is essentially just taking something like an algorithm or a series of steps that we would like to execute and having a computer do that for us and I think sometimes when people think about programming if they're not used to doing it they've never done it before you might have different understandings of what this means so maybe some people are like well I can't be a programmer because I don't know how to make a phone app or I don't know how to build a website or I don't know how to build a service or whatever right like these are all different forms of things you can create with programming but I would say that not one of them necessarily defines the program on its own right so what we can look at doing is taking a simple case which is like a series of steps let's say that maybe I think the easiest way to think about this is a think about something you might do throughout the day or at your job right something that you're doing on a computer that maybe you find you do a task or a series of steps that's repeated maybe multiple times within a day maybe it's something you do every Monday or something you do every day when you come into work you do a series of steps and really like can what computers are awesome at that we don't enjoy doing as humans is computers like they can do steps for you that you set out for them they're not going to complain about it right as humans we don't enjoy doing that and we will complain about it so we can leverage software right we can take our thoughts and our steps that we want to do and have executed for us to tell a machine to do it and then we don't have to worry about it so the most simple case is probably if you've kind of been poking around in programming you might have heard like scripting that might be something that's come up and I'm not going to get into like the the nuances of like what's a script versus a program but I would say generally if what I just explained about maybe automating some tasks and stuff if that seems interesting to you you may want to look at scripting that might be a good kind of intro to like hey after I watch Nick's video and I want to go learn more stuff maybe go check out some scripting so when we talk about scripting and some of these examples that I'm going through it's a scripting a lot of the time is more centered around um I have like a series of steps that I would like to automate right and then if you were to build more things on top of these scripts that's where you might start having applications come together or services that you could build out again the details of what that actually means not super important but what I'm trying to explain is that you don't have to be trying to jump into I don't know building the next huge thing that you're going to sell and I would actually advise that if you're you know interested in starting programming what you don't want to do is necessarily jump right into like being bogged down by what's the best business idea like if you want to learn a program start with the basics right so when we talk about building programs or scripts what we want to be doing is taking our thoughts and putting them into a programming language right so that will be the top level thing that we do and as I mentioned earlier there are tools that can take our code in these various programming languages and then convert that into something that the machine knows how to execute so that's nice but you've probably heard that there's a ton of different programming languages right where do we get started how do we pick a programming language like is there a right and a wrong language and maybe for some people maybe you have been interested in learning to program but maybe you got caught up on this step where you're like okay the idea of what a program is makes sense but there's so many languages like I don't want to go waste time learning the wrong one and then wasted all this effort um what I would say is like there are certainly languages that may be better suited for certain tasks with without a doubt um but I would say if you're learning to program you can probably pick almost any language and if you're taking the concepts about programming you can end up applying those to different languages later so to give you an example um the language that I have chosen to kind of stick with is my my bread and butter let's call it I use a language called C sharp that's my favorite language to use um I can't sit here and tell you oh C sharp is the best language because it's not what's it the best at right like you have to look at languages like things that they do a good job at so for this presentation we don't have to get hung up on what language is the best um what you may want to ask is like what language is more user friendly to get started with right maybe there's some things that you just want to learn about often people will say that the Python language is the most user friendly for people getting started that's okay um if you want you can learn python there are tons of resources about python today when we go through this I'm actually going to get to C sharp code and we're going to walk through some examples there and when we do that What's um going to be important to keep in mind is that we're going to be talking about one language at a time and what you'll want to do is take the the sort of the concepts that I'm showing you right it's a very intro level thing we're going to talk about the concepts but what you'll see me type is in a particular language so to give you a parallel if you think about literally learning spoken languages um there are language constructs we talk about like nouns verbs you might have punctuation and stuff like that right all these kinds of things may look different in different languages and that includes programming languages we call that syntax right in programming so the syntax might look different but the concepts that you're trying to accomplish are actually going to be very similar across many languages how it looks when you code it might be different how it performs might be different but the concepts are generally the same um and I'm I'm talking about generalizations here so again if people are more advanced and they're listening to this they might you know want to pick that apart but I think for for today I think we can take that as reality right there's going to be things that are very common across programming languages but they may look different in how you write it so what I want to be able to do is actually jump into some code and start talking about some intro things and some of these general concepts that apply to different programming languages so I'm going to end up switching my presentation mode here hopefully that doesn't have too many hiccups and it will share my screen and have my face probably in the top right corner um so we'll do that in just a sec and before I do that the thing that we're going to be looking at um that basically all programmers will be using is well like where do you write the code now for myself and people that use a programming language called C sharp there is a tool that we like to use for most of us and it's called Visual Studio um and this is something that is called an integrated developer environment or an IDE now the most basic like IDE you could think of is probably something like notepad on your computer right you just need a spot where you can type code but the other pieces that we usually see in something like an IDE are things that let us run our code or save the output of our code in a format that can be run later right and some of the tools depending on how advanced the IDE is the integrated developer environment they might let us actually execute the code and step through each line of code one at a time and that's called debugging so we're able to step through line by line and go oh that's what's actually happening when I run this software so what I'm going to do is switch over to this other view hopefully nothing blows up so let's give that a shot um seems okay on my side and what we're looking at on my screen right now is a website that's called dot net fiddle and the reason I wanted to use this today is so that if you want to try this literally as you're watching this live and this is recorded as well so if you're watching a recorded version of this you can follow along and try some of the things I'm doing and I also wanted to take this opportunity to mention if you're in if you're watching it live and you're on the chat please feel free to ask questions as I'm going again just keep in mind there's a bit of a delay so I apologize for that and if you're watching the recorded version and something's not making sense like please ask in the comments I will go through the comments later and I'll absolutely respond to you um because usually when I do sessions like this this is something where uh you have the ability to unmute and you know ask stuff like if I'm doing this at work then that's how we would do it right like I encourage people interrupt me ask your questions let's get them resolved as we go okay so I mentioned this is.net fiddle um this is a really basic um web-based IDE again integrated developer environment we have our first ever program here if you just visit this website.net fiddle.net this will already come up for you like I didn't even write this it's already here I mentioned earlier too and I'm just going to jump over to this other tab here right I mentioned earlier that if you're getting into programming a lot of the time if you're reading about this online or watching videos you'll hear people talk about python and python is supposed to be you know one of the more easier to understand languages um easier to understand does not necessarily mean that it is less powerful um it's just a different language I'm less familiar with python so I wanted to show you that you could go to a site like online Dash python.com you can do a web search for like online python IDE and you'll see a bunch of different things that you could do but I encourage you to try something like this because when you go to actually start writing like full programs or maybe you want to write some scripts and things like that you might have to install some tools on your computer locally so I'm trying to save you some time so you can experiment I think this is the easiest way to do it but yeah we have one for python here and jumping back we have net fiddle and this is what I would recommend just to jump in Okay so when we're going to look at our very first program here um I mentioned I didn't even write this it kind of just showed up here when I went to the site there's a couple of things that you're going to see on the screen today and I don't want to go into the details of them because they're part of the c-sharp language so I'm going to highlight them with my cursor and just explain for right now we're not going to focus a lot on them okay so all of the parts that I have highlighted here and all of the parts down here so really right now we only care about line seven that might be a little bit confusing um but we're just going to be talking basically about the stuff that we see from lines five six seven and eight um and we're going to change kind of the contents that we see in here another quick mention um for why I wanted to start with something like this well I guess two things one is that if you go right your very first program in basically any language the the I guess like the meme you would call it is like the first program you usually write is called hello world and hello you can I think you can check it on Wikipedia and get the actual details but hello world is basically like this is your first opportunity to write some software where a computer is able to execute something for you so it's like the computer your software saying hello world like I'm alive so that's where that comes from and the second part for why I like starting this way is that as programmers and you can ask other programmers this if you don't believe me a lot of the time when we're trying to solve different problems we're using other people's code we might go to a site do some research and say like I'm trying to sort a bunch of things and I need to be able to do that but I don't know the most efficient way to do it I need to go download something from a website how do I go do that in c-sharp a lot of our time is spent basically identifying steps that we want to do and then going to look them up online the more experienced you are the more that you're able to retain and kind of you know type out without having to to go search it up but a lot of the time you're going to be basically looking up other people's code and then modifying it and that's okay I'm not suggesting you go copy someone's entire program um and claim it as your own please don't do that that's that's called stealing but when you can borrow pieces and interpret them for your own use cases especially if they're put up for open source usage this is a good example where we can make some changes here and start building some other things so if you're following along and you've gone to dot net fiddle.net in some tab you have open in your browser what we're going to do is this line of code that I have highlighted that says hello world if we go run this so I'm going to press this button right at the top and what this is going to do for us as I explained a little bit earlier is this is going to take the the code that is closer to English than ones and zeros right you might not know what some of these things do and that's totally okay but it's going to go from something that's readable for us and it will at some point put that into instructions that a processor can understand and then it's going to run it for us so if I press the Run button you can see it did a little spinner for a second and I think the output was already down here like I might have run it before starting this so I apologize but you'll see right down at the bottom we see Hello World so cool that's that's the first program that most people ever write real it's and what we can talk a little bit more about what this line does but um we're going to do two things we're going to explain what's happening here and it might not be totally obvious yet and I don't think you need to understand all the details quite yet but I'm going to prove to you that with limited knowledge we can change this to do other things pretty easily so I'll explain it briefly um but when we look at this line there's a couple things going on first of all I'm going to talk about the semicolon of the end of the line here this is um unique to some languages and other languages don't have this but a lot of the time you'll see a semicolon like this you probably almost never use a semicolon normally and a semicolon here is to indicate the end of a line of code that we want to execute in C sharp not every line of code needs to have a semicolon there are certain things that don't but in C sharp this generally indicates the end of a of a line of code to execute so I'm calling this out because when you see this and you're like that's confusing why the heck is there a semicolon here why are the curly braces and other stuff going on here like why are there parentheses this is all about the syntax of the language so depending on what language you want to go learn there's going to be little things that are part of the syntax that you need to learn about so that's one of the things for C sharp is that it has semicolons I'm going to jump to the other tab briefly so sorry if it's a little bit jarring but if you look at this one this is python it's a different language and it's not actually a hello world but here you'll notice there are no semicolons you don't need semicolons in Python right and actually I can my Python's a little bit Rusty but I bet you I can make this say hello world I haven't coded in Python in years but let's just try that super quick right and where's the Run button right Prince Hello World right at the bottom Okay so I'm going to jump back to the C sharp one I just was trying to test my python quickly but um when we look at this we talked about the semicolon that's cool but we know based on when I press play this text that we have here is the stuff that shows up down here like what what's actually going on here and to understand that we have to look at this other part and this I would I would agree that when people compare something like python to c-sharp console right line maybe is a little bit more confusing we've got a couple more things going on we have this thing that's called console we have a DOT and then we have the word right line or words right line and then some parentheses right we have this open parenthesis we have a closed one and then we have some stuff between some double quotes it's a lot going on if you have never programmed anything before and that's okay so this is why I'm spending time trying to look at just this one single line to make sure that we have some clarity on it but really what this part that I have highlighted console right line is something that is built into C sharp um it's something that you have access to as a programmer this thing that's called console and console depending on how familiar you are with um computers I guess if you've ever opened up like a a DOS prompt or a like a command shell if what I'm saying doesn't really make sense to you think uh you've probably seen at some point maybe um like a window on a computer where you have like a black background white text and um different lines kind of uh being printed out one by one on there it's generally referred to as a console there's new things like Powershell and other things like that but the concept is a is a console and what we're saying for this program hello world is that we would like to ask the console to write out a line that has this content so what's going on here is that when you look at this part this is the thing we're asking to do some work for us it's called console and this is one of those things like if you had nothing here to begin with and and I said you know I would like you to write out the words hello world to the console and you've never programmed before you might go I have no idea how to do that so what would we go do and I'm not exaggerating when I say this because I think some people look at programming like it's some you know magic Art or something but we would just open up a tab in our browser and say C sharp right to console that's what I ask you to do right so boom there's tons of examples that pop up so anyway it's pretty easy you can see console right line shows up here but this is how we program stuff most of the time when we're getting started and even though we're not getting started if it's a new topic for us we generally do things like this so I'm gonna go back to here sorry for the black and white kind of jarring changes there but I'm going to put this line of code back in so you might not know console is even a thing you have access to and that's okay um like I said different languages are going to have different things that are available to you so you might have to if you're picking C sharp as your first language you would have to spend some time learning what's available to you so don't worry about that if you didn't know console was a thing that existed not not to worry but the next part is really like this oops this dot that separates console and right line so number one is like the dot actually tells us that we want to access something about console now in this case we want to um get the thing from console that lets us write out text and we call this a function or a method it might be again like these are terms if you've never programmed before you're like I don't know what the heck that means that's okay um I'm I'm going to repeat them again for you but they're a function or a method sometimes in languages you'll hear like procedure just a handful of different words but um they let you organize some steps of code to write and give it a name so we won't go into the details of what functions and methods and all that actually are today but one quick spoiler is that the stuff that I told you not to worry about that says public static void Main this is a function so we're writing code inside of a function you don't have to worry about that for now but that's what this is so we're asking the console we would like to use your function or method that's called writeline and again you might not know that even exists so you can search it online good integrated developer environments Ides good ones will have some type of autocomplete for you so you could literally be typing console Dot and as soon oh it does it here super cool I didn't even try this out like here's a whole bunch of stuff that you could do we could say clear boom oops I have this gigantic microphone in front of my face so I can't see my hands and I'm going to make a lot of typos but anyway my point was that once you know you have console depending on your IDE you have you know you have all these tools in front of you to access different things but we're not going to go into that I just wanted to explain what this line does the last part that we're going to talk about are the parentheses and the stuff inside of it and the parentheses the opening one and then the closing one are sort of like markers that let us pass information into this function so if I take it all out I'm now passing nothing into this function if I am asking the console to write a line with nothing inside of it what would we expect to have happen right if we're looking down here what words are going to come out here if I press run well the answer is nothing right we don't have any text inside of here anymore I took it out so when we write line there's nothing that comes out so if we know we can take it out and nothing's there and we know that if we have Hello World in there that means that if we put other stuff in here we should be able to write it to the console so again with limited knowledge like if you've never programmed before and I said okay now that you know that if you wanted to write a different message and say um like tell me what I want you to write out a message that says like today's date is uh January 8th well that's pretty easy oops right I I'm just typing out English between these two quotes and if I press run now if I said I want you to do this 10 times your answer to that might be well what happens if I do this okay that that worked that's two times so you might go three four five all the way down to ten I only did it five times right and look it it works you you're you're already changing a program to do different things then you might be watching this and going well Nick that's nice but it's pretty useless um yeah we got to start somewhere though so this um this would let you write things on multiple lines right all that I did was copied and pasted some of the code and again you don't have to have intimate knowledge about what this actually does but we can see the output of what's Happening um so just trying to remind you that you should be trying to experiment with stuff like this and I think it's a great way to learn um so just another super quick note I want to try um showing you that you can write different things here so let's take all of these words today's date is January 8th and let's write each one on a new line right it's it's technically a different program it's a simple one and that's okay but if I were to do this right today's date is the next word and then is January eighth okay well each one of these seem to put text on a new line so if I run this it does what we expect today's date is January 8th again these are examples of programs that you might go that's not very useful and that's okay but I'm just trying to illustrate that you can start taking code that exists that's very simple and start manipulating it you can start making little changes and seeing what happens now the next part that I want to talk about is um is actually going to be a little bit more advanced and we're going to be talking about um we're going to use what's called a variable so hopefully that doesn't seem too scary we're going to talk about variables we're going to talk about types and what that means and to start I want to say that I refer to this as text this is text that is being passed into this method in many programming languages this text that we're talking about is actually something that we refer to as a string you might not have ever heard that before and that's okay that's why I wanted to call it text initially so you could maybe relate to it more easily but in this particular case in C sharp in many languages when we see text it is called a string I'm going to jump over to the python one super super quick because you'll see that in C sharp we have double quotes and in Python we have this F I think that's for formatting so we don't necessarily need that but it has a single quote but this is a string in Python oops sorry um what I've just highlighted is a string in Python so again just to show you the same concept of a string right it's what you would probably think of as text but a string in Python we have single quotes here um different languages too have different ways that you can use single double triple quotes all sorts of stuff to represent strings and in C sharp we use double quotes for a string okay so that's nice well what what's a string how do we use that is it do we always just put stuff in quotes and can I just write I don't know like hello inside like oh no like that just doesn't work so you might be wondering okay well now that we know what a string is like what what do I do with that like it seems kind of useless like unless I have something like right line to put it into so this is where variables come in so variables are a concept in programming that is called storage so when we're talking about programs there's often things that we would like to keep track of now one way that we can keep track of strings is that we could say we want to what's called declare a variable that is of the string type so I'm going to get rid of the hello part um I'm just going to push all that stuff a little bit lower and so you can focus on the line I'm writing up here and if we wanted to declare a variable in C sharp we start with the type which is string and then we give it a name so my my variable and then what we would do is assign some value to it so I'm kind of throwing a whole bunch of stuff out at once and this is going to complain for something oh yeah it's telling us that nothing in the program is actually using this variable so let's quickly just recap on what this actually says I said we are declaring a variable but we're doing two things we're declaring a string variable and assigning the word hello to it so this equal sign is an assignment it says take whatever is on the right side and put it inside of this so this gets kind of neat because now we can combine this stuff up here with this stuff down here and now now our program is getting a little bit more interesting so let me delete all that and I'm going to say I want to right line our variable okay so if I go to run this I'm going to pause for a second because I want you to think about what you expect to come out at the bottom I think there's probably two things that people might have on their mind for what should spit out here in the bottom we should either see the word my variable show up down here or we should see the word hello come out down here so I want you to think about that for a sec and maybe there's a third option um I don't know but I think the two possibilities people are probably thinking to show up down here are that we see Hello or we see the word my variable now that I've given you some time the answer drum roll is hello and the reason we see Hello down here is because we've taken the string hello we've assigned it that's what this equal sign is we've assigned it to this variable called my variable that is of the string type and now when we go back to this the first thing we ever saw when we were working together here right was console right line and now we're saying I want you to print the value of my variable and that's why it's printing out hello because it's taking the value that is stored inside of my variable which is hello and putting it out to the console yeah I can zoom in for sure is that easier to see this is just something that's in this web IDE that I'm not totally familiar with so hopefully that's all full so when we get a little bit more complicated here we can do other things so well we talked about strings right hello is a string and then I'm going to talk about quickly the other thing that people always get scared about and that's math right I mentioned already at the beginning of this and I can't recall if my audio was still messed up or not but I'm not good at math and I program regularly but how can you not be good at math and program right because people are always afraid well it's not that there's no math in programming it's just that generally the math you're doing in programming is things like Counting I can count I've been able to count most of my life which is great um but a lot of the time the math that you're looking at is really not very difficult there's going to be Industries you work in if you were working in programming for finance there's probably some pretty intense math but that's specific to finance right um I worked for eight years in digital forensics and there was lots of math but that math was like counting file size for example um you're not doing like calculus and really complex math oh well I'm glad thanks for the recommendation Jamal I didn't realize that it was too zoomed out for folks so I'll keep that in mind for next time um so let's quickly talk about some of the other types we can use and we're going to talk about numbers because we're going to talk about everyone's favorite topic math so numbers can be stored in different ways and there's going to be I'm going to keep it simple here but there's some computer science and sort of like low level stuff to think about but when us as humans talk about numbers we have things like you know the numbers zero one two three these are things that we would call integers they are whole numbers that can be easily represented that way there are basically infinite numbers though so how can we possibly represent an infinite number of numbers in software and the answer is that we don't we actually have some tricks so we won't go into the details of that but we're either talking about numbers that are integers so I'm going to call it my int which for my integer and I can say it equals one two three now the other types of numbers I'm not going to I'll just mention them but um they are float and something that's called double and that's a slightly more advanced topic but those allow you to use things like decimal places in your numbers so integers cannot have decimal places and this is kind of interesting right because now you might be going okay well I wanted to maybe write a program that worked with um finances right I wanted to do something that could print out my budget for the week or something like that and that might be tricky if you're only using integers so you have to think about some of the tools that are available to you and then work with that so if I said cool we got my int now and I want you to write that to the console how does that work well if we look at this other example all that I had to do here was put the word my variable here and we we could see that the word hello came out to the console okay so what if I just put my intear I'm going to get rid of this one does it work it does now there's a trick that you're not able to see easily and I'm going to see if this IDE if dot net fiddle shows us but the point that I want to get across is that we're talking about two different types of variables now it doesn't show you here unfortunately um just to show you quickly remember we declared the string one with the word string and the uh the integer one with the prefix here int these are two different types of variables the right line works because there are different versions of it that you can't see easily here that allow you to pass in strings or integers so let's forget that for a second and if I said I want you to print out um this variable that's called my variable followed by my int the contents of that how would you put it down here well this is going to be something that we're going to call um like it's another assignment and we're going to be dealing with two different types so this might get a little bit confusing so um we'll try it again it's a pretty simple example but if you've never seen it before it's not obvious so if I wanted to combine these two things really if you think about it if I asked you to combine hello and a number one two three well one of them's a number and if you added two numbers together we all know that like we could if I said add one two three and the number two you would say well it's one two five right you just do addition but we have a string and we have a number so how do we combine them and that I mean it's interesting because there isn't like a right answer to it and you have to make a decision about what you want to do so what I want to do in my case is I want to um I'm just going to write it up here what I want it to look like I'm going to use a comment is I want it to look like it says hello one two three that's what I want it to look like so how do we accomplish that well someone who's watching this might go well why don't you just type it out right like that's that's the the obvious thing so um I'm just going to call this new variable combined and you might say well there's the answer Nick and you're right so that is the answer but um that's going to be cheating in this case I want you to actually use these two variables to accomplish it so if we wanted to combine an integer and a string to get a string in C sharp we can actually do that pretty easily some languages it's easy to do in other languages you have to be very explicit about how you'd like this to work but what we can do is actually type my ver oops you have to spell things properly that's the hardest part about programming so you would take something like my variable right we know that the value of that is the word hello and then we can use an addition operator and one thing that we don't have in our variable that you might not have recalled because I deleted the comment is that I want a space between the two so I'm going to add a space and then I can actually add the number here so this actually works in C sharp and like I said different languages have different Behavior here but what this means in C sharp is not a mathematical ad and that might sound weird to you because we're talking about words here but what I'm saying is it's not a mathematical ad because the word hello to us is not numbers and a space is not numbers to us so when you're talking about strings together in C sharp the addition sign is what's called concatenation so it lets us take two strings and put them together so that's really cool because now we can take my variable we can concatenate a space and then the last part here is kind of weird still because well my int is a number so what does this operator it's called an operator right so what does this operator mean when we're trying to take a string and add an integer to it well in C sharp the result of a string and an INT being added together is still a string so what this actually does that you can't easily tell here is that this will actually convert our number into a string representation and that again might not seem obvious to you if you're not familiar with how types work and that's okay but if we go to write this out now and I run this we get hello space123 so just I'm going to move on to a different topic because we're running out of time that I wanted to allocate for us today but just to give you a super quick variation um on why the whole integer string thing is uh kind of interesting here um I'm going to call this um I don't know naming stuff is really hard other variable sorry not creative enough and what we're going to do is I just wanted to to show this to you super quickly oops that doesn't exist anymore sorry about that okay so these two things they look similar but they are very different one two three here is an integer and one two three here is a string so this is probably a better example for me to have used before but um if I were to try and write this out to the console right oh I don't know why this didn't come up before but this is where I was trying to show you that you can it's already gone sorry you can pass in other things and I can't make it show up again but you can pass in other things into here so if I said I want you to add these together right one's an integer one's a string well what do we expect to come out what would we expect to come out of here because one of them is a number and the other one is a string right and all that I'm doing is just like before I'm adding two variables together if I press run we get one two three one two three some of you might have been trying to get a calculator out or did it in your head and said well one two three plus one two three is actually 246. and you're right it is but in C sharp you are taking a string which is this one here sorry a string and an integer this will concatenate them and make this one also a string so that's why you have one number followed by the other number if you wanted to actually make this show up as 2 4 6 as the result and actually add the numbers together that's where you would have to convert this to an integer we're not going to do that today but I just wanted to show you that there are differences in the types of variables that we use okay I'm a little behind time so I'm going to Omit one topic which is called Loops which is really fun but we're going to talk about one last thing which I would say is one of the primary building blocks in any program so we talked about variables and that's how we store things and that storage that we're talking about is in memory for the the program that's running so it didn't go right that stuff out to a file somewhere on your computer um that's just used in memory while the program is running the next part we're going to look at is how we control logic so I talked about storing stuff but what happens when you want to make decisions because making decisions in programs is really one of the core building blocks and in different levels of programming and languages it's called um either an if statement because you are asking if a condition is true then you do something and then else you would do something else that's called an if statement another way to look at it and I guess in really low level stuff you would hear branching because you're following One path of execution right your code is running line by line that's nice and then it would get to a decision where it needs to Branch between one way or another so how does that look well in C sharp it's literally you start by writing if and we have stuff inside of parentheses so again this is some C sharp specific syntax so don't worry too much about it but we would put our condition in here so we have to write something inside of here and then we're going we don't have to do this but um you'll see it written with curly braces okay so usually you will see this where we have some condition in here so like if true this is a really simple one we're gonna write hello world out so this is our very first if statement um for single line if statements you don't need the curly braces you can just write it like this I just recommend that you don't start practicing this way um and I say that because um it's a C sharp in some other languages it's specific where if you wanted to write this this does not do probably what you think because if this condition is true it will do what's a I'm using a poor example here it's not going to check this condition for both of the lines here so this is probably like it looks almost like a typo really in Python this probably does what you think so let me change this a little bit I'm going to write hello world like this and I'm going to change this to false so when we talk about if statements it's checking inside of the parentheses is the thing true or false that it results in so if I write if false it will never be true just by definition false is never true so what would happen if we run this why is World printing we said false false is never going to be true so none of this should have run but this is why I'm telling you that you need to have curly braces because this syntax is what it's called right this syntax where you put one line underneath an if statement in C sharp only works for the single line following the if statement so basically long story short forget about doing it this way and always use curly braces always the curly braces say that anything inside the curly braces is now going to be controlled by the if statement so again if I run this now it should print nothing because these are grouped together under the if statement so pause for a second might be a little bit confusing because you're seeing other characters and stuff you're not like people don't often type curly braces in English if you're writing essays or emails right you're not usually using semicolons but these are things that are part of the syntax we use in c-sharp and some other languages so if inversely if I put true here I have to spell it right this will always be true and it will write these things out okay what are some other ways that we can make this a little bit more interesting well let me do this let me bring back those other variables we were talking about my number right so what does this mean well I have declared an integer called my number and I have assigned one two three to this variable so anytime we want to ask what my number is it will tell us it's one two three now I want to do my number two and this is going to be four five six okay so yes there are numbers here no this isn't any scary math um but we can do a check now we can say something like if my number and this is a C sharp specific thing so you see the equal sign here this is an assignment if you want to check if things are equal in C sharp you need two equal signs again might not be obvious to you that's okay a lot of this stuff isn't until you practice it but we will say my number two okay so what do we think is going to have or happen for an outcome here we have these two numbers we're checking if they're equal so we're saying if the numbers are equal right these two lines out well before we run it let's talk about it my number is one two three my number two is four five six does the number one two three ever equal four five six no the two very different numbers so if I press run I expect to see nothing show up here and I expect to see nothing because this is false this always comes out to false so let me run it there we go you can see there's nothing down here but we can do other comparisons we can check other things here so we might be able to say well what happens if we want to see if my number is less than my number two right the arrow sign to the left is a less than so if I run this it is true and it prints out the contents here right because my number this is this is functionally equivalent to me going one two three is less than four five six if it wasn't totally obvious before that's what this ends up doing right so one two three is always going to be less than four or five six now one final part here because we're a little bit over um is you can also check the inverse condition Okay so we'll put some other text into the console right so if my number equals my number two we will write this out right so we'll see hello and World else means otherwise right so if this condition is not true we go down to here and there's no other Condition it's checking it's just saying we know that this one was false so let's jump down to here so if I run this it will say goodbye right because we know that again I'm just gonna I'm gonna put the numbers into here one two three 456 we know one two three does not equal four five six so all of this code never gets run and we'll get this we'll get the goodbye printed out okay so that's mostly it for today um so just a super quick recap the things that we got to talk about are um that there's going to be differences in the programming languages that you might want to look at um a really popular one to get started with is python um python you don't have a lot of these extra things like Curly braces and semicolons right um none of that was here before so it might be easier for some people to get started in Python it's not my language of choice so I generally don't go to that but you might have you know um an enjoyable time getting started with that but you're not gonna make a wrong choice if you start learning a language the things and the concepts that you'll learn about that language can be applied to other languages so python has variables in it python has if statements python has Loops in it C sharp I was just talking about all those things so clearly it has it so don't worry about picking the wrong one I just recommend you get started and you try sticking with it so we talked about variables if statements I did not get to Loops today so if you're looking for a little bit of homework maybe you said yeah Nick this was nice but it was maybe it was too simple cool um I recommend trying to go look uh at Loops in C sharp or if you're looking in Python you know search for examples of Loops in Python um I think that would be great homework to try out um and I think that's mostly it so again if you end up re-watching this video later you're jumping through it um there were some comments in the chat so thanks folks for being able to chime in on about stuff and I would say if you're re-watching it feel free to leave comments and ask questions because I can respond either so there's no such thing as a dumb question if you don't know how something works or you don't know where to find an answer ask there's nothing to be embarrassed about um like people don't just know this stuff without practicing it so I'm happy to try and help um and get you the answers you need so thank you so much for watching um I'm gonna try to do more of these in the future they'll all be pretty similar I'm trying to kind of do a bit more of like intro to programming so I do appreciate you tuning in to watch um if this helped at all um please uh like the video that would help a lot um And subscribe to the channel too because if you like content like this I'll try to be putting out more

Frequently Asked Questions

Do I need to be good at math to learn programming?

No, you don't need to be strong in math to get started with programming. I considered myself good at math in high school, but I don't have much interest in it now, and I still program regularly. Programming is more about logic and problem-solving than advanced math.

How do I choose the right programming language to start with?

There's no one-size-fits-all answer to this. You can pick almost any language to start learning programming concepts. For beginners, Python is often recommended because it's user-friendly. However, I primarily use C#, and you can learn valuable skills in any language you choose.

What should I do if I find programming challenging?

It's completely normal to find programming challenging at first. I encourage you to stick with it and practice. Just like learning a new language, it takes time and effort. Don't beat yourself up if you struggle; instead, focus on experimenting and gradually building your skills.

These FAQs were generated by AI from the video transcript.
An error has occurred. This application may no longer respond until reloaded. Reload