1 00:00:00,800 --> 00:00:01,590 ‫Welcome back. 2 00:00:01,610 --> 00:00:06,530 ‫And this video I would like to teach you about variables, because variables are a very important aspect 3 00:00:06,530 --> 00:00:08,090 ‫in any programming language. 4 00:00:08,240 --> 00:00:11,450 ‫A variable is a container that can take a value. 5 00:00:11,450 --> 00:00:18,320 ‫And maybe after some time we decide to store another value in the same variable, meaning in the same 6 00:00:18,320 --> 00:00:19,010 ‫container. 7 00:00:19,010 --> 00:00:21,470 ‫So let's look at this trivial example here. 8 00:00:21,740 --> 00:00:28,700 ‫Imagine you are in an open buffet and you want to take a cup of coffee along with an amazing cake. 9 00:00:28,730 --> 00:00:37,100 ‫You would need a cup for the coffee and a plate for the cake because a cup of coffee is made to take 10 00:00:37,100 --> 00:00:39,500 ‫liquids, not, for example, cake. 11 00:00:39,650 --> 00:00:46,130 ‫Putting the cake in a cup of coffee would not work because it won't fit and probably because people 12 00:00:46,130 --> 00:00:47,330 ‫will stare at you. 13 00:00:49,260 --> 00:00:51,810 ‫So this is exactly how variables work. 14 00:00:51,840 --> 00:00:59,280 ‫If we compare variables to our coffee example, a variable must have a type which is the type of plate 15 00:00:59,280 --> 00:01:00,090 ‫or cup. 16 00:01:00,090 --> 00:01:06,930 ‫For example, the type of the variable will tell us what kind of data it can store, where the data 17 00:01:06,930 --> 00:01:08,940 ‫is our food or drink. 18 00:01:08,940 --> 00:01:15,000 ‫And because we usually deal with many variables in our programs, we will need to distinguish between 19 00:01:15,000 --> 00:01:18,840 ‫our variables by giving each variable a name. 20 00:01:18,960 --> 00:01:23,340 ‫So you have to type the name and the data that is inside of it. 21 00:01:23,850 --> 00:01:26,820 ‫NC Sharp This is how we define a variable. 22 00:01:26,850 --> 00:01:33,300 ‫Let's say we want to store an integer number, whereas an integer number is a whole number like one, 23 00:01:33,300 --> 00:01:34,770 ‫two, three and so forth. 24 00:01:35,520 --> 00:01:38,010 ‫Then int is our variable type. 25 00:01:38,370 --> 00:01:42,000 ‫So I am a number is the name of our integer variable. 26 00:01:43,300 --> 00:01:46,070 ‫And finally, five is the value. 27 00:01:46,090 --> 00:01:51,010 ‫So we have to type the name and the value that we assign here. 28 00:01:51,310 --> 00:01:58,660 ‫This way we created the variable of type int and we named it I am a number and we stored the value five 29 00:01:58,660 --> 00:01:59,650 ‫inside of it. 30 00:02:00,550 --> 00:02:06,490 ‫There are other data types in C-sharp besides the most important ones that we need to know about for 31 00:02:06,490 --> 00:02:13,540 ‫now are float, which we use to store float numbers, meaning numbers that have decimal points like 32 00:02:13,540 --> 00:02:14,080 ‫pi. 33 00:02:14,410 --> 00:02:17,650 ‫We can use them to store values like speed, for example. 34 00:02:17,680 --> 00:02:23,210 ‫Then there is pool which we use to store boolean values which can be either true or false. 35 00:02:23,230 --> 00:02:29,650 ‫We use them to store values like steps enabled, and we can then use these booleans to decide what to 36 00:02:29,650 --> 00:02:30,730 ‫do in our app. 37 00:02:30,760 --> 00:02:37,000 ‫For example, if the GPS is not enabled, so is G.P.S. enabled equals false? 38 00:02:37,000 --> 00:02:38,270 ‫Would be the statement here. 39 00:02:38,290 --> 00:02:44,410 ‫Then maybe we want to show a message to the user to enable the GPS to use the app. 40 00:02:45,230 --> 00:02:48,540 ‫Then we have string which we use to store text. 41 00:02:48,560 --> 00:02:55,190 ‫We need to use the quotations to specify that these are actually text and not code. 42 00:02:55,400 --> 00:02:58,760 ‫We can use them to use the username, for example. 43 00:02:59,330 --> 00:03:05,360 ‫Then we have char, which we use to store a single character, like an ad sign or a dollar sign. 44 00:03:05,390 --> 00:03:11,690 ‫We can use them to store special characters because if all we need is one character, then a string 45 00:03:11,690 --> 00:03:13,100 ‫is going to be an overcoat. 46 00:03:13,130 --> 00:03:17,030 ‫So it's taking more memory than the character. 47 00:03:17,420 --> 00:03:22,580 ‫So the more variables we declare, the larger memory our app is going to require. 48 00:03:22,670 --> 00:03:28,850 ‫Think about it as if you are using a very huge coffee cup to store a small amount of espresso. 49 00:03:29,060 --> 00:03:34,720 ‫So that was a little bit of an introduction into the ideas of variables and data types in C-sharp. 50 00:03:34,730 --> 00:03:39,470 ‫We're going to use them in practical examples and then it will make a lot more sense. 51 00:03:40,100 --> 00:03:40,490 ‫All right. 52 00:03:40,490 --> 00:03:46,700 ‫So that was a super high level view onto variables and data types, and we only saw a couple of them, 53 00:03:46,700 --> 00:03:46,940 ‫right? 54 00:03:46,940 --> 00:03:47,930 ‫Three different types. 55 00:03:47,960 --> 00:03:53,420 ‫Now, let's look at data types in more depth and a couple of examples in the presentation. 56 00:03:53,420 --> 00:03:58,190 ‫And then after that, we're going to look at particular examples where we are using different data types 57 00:03:58,190 --> 00:04:03,470 ‫and see how they interact with each other, because that's also something we need to take into consideration. 58 00:04:03,470 --> 00:04:10,280 ‫But first, let's look at more data types as well as learn how they are limited because you can only 59 00:04:10,280 --> 00:04:13,880 ‫use certain values inside of data types. 60 00:04:13,880 --> 00:04:20,300 ‫Even though an integer can hold a number, it's not capable of holding a number like a trillion, for 61 00:04:20,300 --> 00:04:22,700 ‫example, and that's where loans come in. 62 00:04:22,700 --> 00:04:25,340 ‫So let's look into that in the next video.