 Hey everybody, this is Brian. If you're following along, this is our fifth video on Visual Basic. Today, we're going to be talking about variables. I want to continue down the variable road and discuss different types of variables. Last tutorial, you learned what a string was and you learned what a variable is. So this tutorial, let's just go over some of the different types. Admittedly, I'm cheating. I'm just going to show you this web page. Different types are bolean, four bytes long, true or false. Don't really worry about the size just yet. I mean, that's kind of where how it's stored in memory. Don't worry about this column. We'll get into namespaces later. Just worry about the type and this final column. So bolean is true or false. It's like a light switch on or off. A byte is 0 to 255. When you see these letters on the screen, yes, they appear to be letters, but they're actually a number. 0 to 255 and something called ASCII. We'll cover that further down the road. A character, 0 to 65,000 unsigned. What does unsigned mean? Unsigned means it has to be positive. It cannot be a negative number. It can't be like negative five. So if it's signed, it can be negative five. If it's unsigned, it can only go down to zero. A date is a date time, for example, January 1st. A decimal is a very, very, very big number, as you can see, with no decimal point or with a decimal point. 28 places to the right of a decimal, small as zero. I mean, these are just massive decimal numbers. A double is 8 bytes. It's kind of like a smaller version of a decimal. Integer, four bytes. Basically, you can get a fairly large number. Most of the numbers you'll actually work with typically are integers or the next one, which are longs. A long is a bigger version of an integer. Really, why do we have all these? Well, we have all these because not everything's going to be perfect. Sometimes you'll need a massive number, like a long or a double. Sometimes you'll need a smaller number, like an integer, or even a byte, zero to 255. It just depends on what you're working with. And then there's other things, such as short. Notice how we're skipping over an object. We're doing that for a reason. Come back to it in a second. Short is 16. Notice how it's 32. If you're coming from, let's say, Visual Basic 6, one of the older versions of EB, short is actually the same size as integer used to be. Integer is now long and long. It's just humongous, but string, we've learned what string is. That's just a sentence. And in .NET, things are unicode. So you can go up to 2 billion unicode characters. Oops, sorry, we skipped single. Singles are just massive numbers. User-defined types, you can actually create your own variables, which we'll do later. Let's jump back to object. What is an object? Remember from our previous tutorials, everything is an object. So even though these are numbers and letters and on-offs, they're objects. And you can treat them as such. Flip over to our code window. I've already created a console window with our trustee console read line. And let's just create a few of these. So let's say dim and we'll say m cost. And we'll say a single. Don't really need a single, but let's just do it anyways. And we're going to say that's going to cost me 89 cents. So cost of whatever this is going to be is 89 cents. You can also say dim happy as bowling. And in this case, we'll say true because we're happily watching this tutorial. If you're not, please pause the tutorial, go on there in the room, get happy, and then come back. And we'll say dim name as string. We've seen the string before. These are variables. And you notice how they all follow the same structure. You write dim, whatever you want to call your variable. And then you say as and then the type. And then you assign it. Now, the reason why you want to assign a value is if you try to use one of these variables and it has not been assigned, it'll more than likely crash your program. So let's say dim, we'll just say number as int or integer. And let's not assign it. You notice how it puts us quickly line saying unused local variable m number. Now, let's try to add two to that. Well, if you try to add two to nothing, what do you think is going to happen? Now, this is kind of a trick question. I'm trying to throw you off intentionally because I want you to think about plus equal. What does this do? Run it. It didn't crash. Why not? Well, because we're assigning it, number is nothing. And we're saying add two to nothing. So it's essentially saying two. Let's see if that's correct. Console dot write line. Now, you notice as you type, IntelliSense in the background is picking out your variables that you've declared. That's a very handy feature will save you a lot of time. We run our work. Sure enough, there's the two. Plus equal is a handy way of incrementing a value and assigning it all at the same time. Now, if you just say number, oops, plus two, it barks at you. Expression is not a method because it's nothing. You can say number equal number. Oops, having technical difficulties bear with me. Number plus two. So you're saying nothing plus nothing equals two. If you're coming from an older version of Visual Basic, you'll notice this is much more friendlier. It will automatically assign a zero to it and then add the two. Where previous versions would just crash and explode into this big ball of fire and your computer would melt. Okay, so what we've covered today is that there are multiple types of variables. These variables are objects. For example, you can say number dot. And you have properties, many properties. It's not just a number. It's actually an object. You can say equals get type min max parse to string try parse. I mean, we'll cover all these later. But what you should understand is that in the background, this is an object, not just a number. And that there are many types of variables, not just strengths. Now you might have noticed this huge list of options when you type as these are all objects within the dot net framework. Some of these are namespaces like link, which you can drill deeper into some of them are enumerations. Some of them are classes. We'll get to all those in time. What I want you to worry about are just the basics at this point. Don't get confused. Don't get frustrated. Stick with the simple stuff. We're going to have to cut this tutorial a little short. I hope you found this educational and entertaining. Your homework for tonight is to go out and Google vb.net variable types and just read up on some of the different types of variables that are out there. Typically, you'll find that you will rarely use all of them. You'll probably stick with just a select few. Thank you for watching.