1 00:00:00,120 --> 00:00:04,770 Welcome back in this video, we're going to look at other data types such as billions. 2 00:00:05,490 --> 00:00:06,570 So for example. 3 00:00:08,039 --> 00:00:14,490 Bullying is a type which represents logical values, so it can have two possible values, true and false. 4 00:00:14,760 --> 00:00:18,660 So we have this variable called is sunny and I'm going to make it to bullying. 5 00:00:19,020 --> 00:00:20,880 And now I'm going to assign truth to it. 6 00:00:21,360 --> 00:00:24,720 Let's say a little later, the sun is not shining anymore. 7 00:00:25,110 --> 00:00:26,850 Then I can just say it's sunny. 8 00:00:27,630 --> 00:00:28,980 There's going to be false. 9 00:00:29,190 --> 00:00:34,350 So I reassigned a new value to it, so I assign faults to it now. 10 00:00:34,380 --> 00:00:38,220 So sunny or is sunny will now be false. 11 00:00:39,480 --> 00:00:44,850 Of course, I don't need to assign the bullion to it, or I don't need to explicitly state that I want 12 00:00:44,850 --> 00:00:50,700 to use it as a bullion because once I assign a bullion value such as true to it, it will know that 13 00:00:50,700 --> 00:00:52,590 his son is going to be a bullion type. 14 00:00:53,220 --> 00:00:57,600 Then there is a another type which is called character or char. 15 00:00:57,990 --> 00:01:06,120 So you can assign a char by using the post office so you can see the value letter. 16 00:01:06,120 --> 00:01:16,050 Char is just an A, and I make this a char by assigning a value or a letter in this case, which is 17 00:01:16,050 --> 00:01:17,430 surrounded by apostrophes. 18 00:01:18,150 --> 00:01:25,780 So if we look at letter char, we can see it's of type char, which is character that it did. 19 00:01:25,780 --> 00:01:27,990 The char is also of Typekit char. 20 00:01:28,380 --> 00:01:30,270 It's really not that much of a difference. 21 00:01:30,270 --> 00:01:34,830 It doesn't matter if it's an a a one or even a dollar sign. 22 00:01:35,310 --> 00:01:38,520 But as you can see, it cannot contain more than one sign. 23 00:01:39,120 --> 00:01:40,980 That's the limitation of char. 24 00:01:41,430 --> 00:01:45,990 So a string is basically a connection of multiple chars. 25 00:01:46,260 --> 00:01:48,270 It's just multiple chars together. 26 00:01:48,270 --> 00:01:53,130 In this case, it's five chars which come together to becoming a string. 27 00:01:53,610 --> 00:01:57,030 Now that we talk about string, let's have a look at strings a little more. 28 00:01:57,540 --> 00:02:05,190 So let's assume we have this string variable, which is called my string or my SDR, and it has to text 29 00:02:05,190 --> 00:02:05,760 Helloworld. 30 00:02:06,450 --> 00:02:13,590 Now, if I want to access a certain character from that string, what I can do is I can use the following 31 00:02:13,590 --> 00:02:14,370 approach. 32 00:02:14,580 --> 00:02:22,260 So I'm going to call this one first char in string, and this will be my string. 33 00:02:22,860 --> 00:02:26,360 That's the position zero y zero. 34 00:02:26,790 --> 00:02:32,160 Well, because Scotland is a language which starts calculating or counting at zero. 35 00:02:32,460 --> 00:02:38,010 There are other programming languages which start counting at one such as hour, but most programming 36 00:02:38,010 --> 00:02:40,500 languages start counting at zero. 37 00:02:40,500 --> 00:02:42,870 So zero is the first letter. 38 00:02:43,260 --> 00:02:50,520 So if we print just now, let's say we want to print this first chart in a string. 39 00:02:51,240 --> 00:02:56,070 So let's just do that first character. 40 00:02:57,430 --> 00:02:58,810 And we run this code. 41 00:02:59,080 --> 00:03:00,070 So let me. 42 00:03:01,290 --> 00:03:02,010 Run it again. 43 00:03:02,850 --> 00:03:06,690 And we see first char or first character is H. 44 00:03:07,560 --> 00:03:07,920 All right. 45 00:03:07,920 --> 00:03:10,950 So in Helloworld, the first character was, in fact, H. 46 00:03:11,550 --> 00:03:15,450 If you want to get the last character, what you can do is the following. 47 00:03:16,380 --> 00:03:18,540 So I'm just going to paste it in here. 48 00:03:19,170 --> 00:03:25,950 Last character and string will be again my strength, and then in square brackets, I use my strength 49 00:03:25,950 --> 00:03:26,590 at length. 50 00:03:26,940 --> 00:03:29,220 With this, I get the length of the whole strength. 51 00:03:29,760 --> 00:03:36,840 And then I say minus one, which just says, OK, give me the last one, because if the length is in 52 00:03:36,840 --> 00:03:37,410 this case. 53 00:03:37,830 --> 00:03:38,310 11. 54 00:03:38,500 --> 00:03:42,840 So five characters here, then one, which is this empty space. 55 00:03:43,200 --> 00:03:47,730 And then another five characters become two 11 characters. 56 00:03:47,970 --> 00:03:51,090 So 11 minus one is going to be 10. 57 00:03:51,390 --> 00:03:56,190 So we're going to get the 11th position, which is going to be the deep. 58 00:03:56,700 --> 00:04:00,090 So now let's just print out the last character. 59 00:04:01,430 --> 00:04:07,300 And we can see this last character as which is, in fact, Helloworld with the D. 60 00:04:07,940 --> 00:04:08,480 All right. 61 00:04:08,510 --> 00:04:09,800 So some meaning it up. 62 00:04:09,980 --> 00:04:14,720 There are multiple different types that we can use when we create variables. 63 00:04:15,170 --> 00:04:20,810 Variables are immutable if we use the vol keyword and there are mutable, so changeable. 64 00:04:21,050 --> 00:04:28,970 If we use the VAR keyword, then we don't have to specifically state what kind of data type we want 65 00:04:28,970 --> 00:04:29,390 to use. 66 00:04:29,630 --> 00:04:37,220 If we assign the right value to it, if we assign a value which is of a specific type, such as a number, 67 00:04:37,220 --> 00:04:41,360 which is a whole number, it will automatically assume that we want to have an integer. 68 00:04:41,570 --> 00:04:48,020 So if we want to have a byte or short, for example, then we would need to explicitly state that by. 69 00:04:49,290 --> 00:04:56,580 Creating the variable with that type and with long numbers, we can use an underscore in order to make 70 00:04:56,580 --> 00:04:57,480 it more readable. 71 00:04:57,990 --> 00:05:00,510 This is a new feature that is super useful. 72 00:05:00,510 --> 00:05:03,280 We can use that for string, for integers as well. 73 00:05:03,300 --> 00:05:09,660 By the way, this makes them more readable, and the same concept goes for doubles as well, where the 74 00:05:09,690 --> 00:05:14,460 assumes that we want to assign a double if it's a floating point number. 75 00:05:14,730 --> 00:05:22,080 But if we want to specifically use a float and we have to state that by adding an F to the number itself. 76 00:05:23,170 --> 00:05:29,800 Then there is the Thai bullion, which is used to only have two states, so either something is true 77 00:05:29,800 --> 00:05:34,030 or something is false, which is a super useful, and we will use that quite a bit. 78 00:05:34,720 --> 00:05:40,150 And we have characters which we can use in order to just one use one character, which doesn't have 79 00:05:40,150 --> 00:05:45,280 to be a character, but it can also be a number or a symbol. 80 00:05:45,850 --> 00:05:52,060 Then we have strings, which is a collection of a bunch of characters which we can use for text. 81 00:05:53,020 --> 00:05:58,300 And if we want to print something out, we can use this print statement, which then prints it onto 82 00:05:58,300 --> 00:06:05,290 our console, which is just a little area here at the bottom, which helps us to test stuff and test 83 00:06:05,710 --> 00:06:08,530 if a certain variable has a certain value. 84 00:06:08,950 --> 00:06:13,120 Of course, there are other ways to do so, but the print statement is a very convenient one. 85 00:06:14,860 --> 00:06:20,140 And another one important aspect, and I told you multiple times, but I really want to state that again, 86 00:06:20,680 --> 00:06:30,280 you don't have to specifically state your data type because of type inference, and maybe I'm going 87 00:06:30,280 --> 00:06:35,650 to add this word here type interference, which just means that. 88 00:06:37,050 --> 00:06:43,860 Finds out the tape from context, which is super powerful and useful and makes our life a lot easier 89 00:06:43,860 --> 00:06:44,880 in most cases. 90 00:06:45,690 --> 00:06:47,580 So let's say see you in the next one.