[MUSIC] So we're talking about variables and we're going to talk about how you initialize them, but first, let's finish up the types. So every variable has to have a type. And you can make type declarations where you actually define an alias, an alternate name for a type. So sometimes this is useful for clarity inside a particular application. For instance here, it could help you, say you got you got some kind of application and it's working on temperatures. Temperatures are something that it's manipulating, right? And every temperature you want it to be a floating point value, 64 bit floating point value. So you can define a new type, an alias for a new type, type Celsius float64. In that case, Celsius is exactly the same as float 64. Now, you can always declare your variables to be float64, but Celsius might make sense in the context of the application, right? Maybe the application is about temperatures. So maybe you want to rename is [COUGH] just to make it clearer for you as a programmer. Also, like the next one, type IDnum int. Maybe I want to, maybe I'm making some code that implements a database of users or something. And every user has an ID number. So I know this type, this concept ID number. I'd like to, I know it's an integer, but I want to name it. I want to give it that name IDnum, so that I know every variable that it declares an IDnum, it is an IDnum. I know something about it just based on the name of the type. So once you declare a type like this, type Celsius float64 or type IDnum int, you can now declare variables using that alias. So I can say var temp Celsius, right? And now temp is going to be float64 because float64 is aliased by Celsius. Also, var pid IDnum, pid is actually an integer. But we call it an IDnum and it makes things more clear. So initializing variable values, every variable has to be initialized somehow before you use it. One way to initialize it is in the declaration itself. So you can say var x int = 100. And that will make x an integer, it'll declare it as an integer, but it'll also set it equal 100. Or you can just say var x = 100. Now, if you do that you're not saying you want it as an integer. So it will infer the type, it compile with a further type based on the type of the right hand side value. So the number 100 is an integer, so it says x must be an integer, makes it an integer. Now, remember, sometimes this is an issue because maybe it infers something you don't want, right? I like to specify myself, but maybe. So, for instance, say I say x = 100, but I really want it to be a floating point. I mean, 100.something, right? But I call it 100 because that's my initial temperature that I want, but I want it to be a floating point value. This will, if I don't specify, it'll say, well, 100 could be an integer, it'll infer it as an integer. And then if I try to set x to 100.1, I'll have a problem. So I like to specify the type, but you don't have to. Next up, initializing after the declaration. So you can just say var x int, and then afterwards you could say x = 100. And then it'll follow the line. That's another way. Now, if you don't explicitly initialize a variable, it'll still get a value. It'll get the zero value for its type. So, for instance, say I say var x int. The 0 value for its type is 0, right? So x will be automatically assigned to a 0, initialized to a 0, if I don't say anything else. If I say var x string, the zero value for a string is just the empty string. So x would be initialized to the empty string in that case. Now, another way to initialize variables is using a short variable declaration. Now, in this case, you're performing the declaration and the initialization together using the colon equals operator. So up on the slide x := 100, okay? When you say that, this is a case where x has not been declared yet, right? So this statement actually declares x and initializes it. Now, the declaration, what happens is that when you use that colon equal, the type that it sets it to be is whatever's on the right hand side. So 100 in this case. It sets, it looks at 100, says, that's an int and it infers x to be an integer and then it assigns it to the value 100. So variable is declared as a type of expression, the type that's on the right hand side. So it does, this type of variable declaration, it does the declaration and the assignment together in one line with this special operator. You can only do this inside a function. So you can't do a short variable declaration outside a function, that's not legal. So just know that.