WEBVTT 00:01.490 --> 00:03.830 Welcome to the fourth part of the curse. 00:04.680 --> 00:11.520 Until now, you are using singular values, only now it's time to learn about more advanced data types 00:12.270 --> 00:16.890 in this path, you're going to learn almost everything about the composite types. 00:17.790 --> 00:24.540 A composite type is a type that is constructed by using other types, and a composite value can store 00:24.540 --> 00:25.830 more than one value. 00:26.820 --> 00:29.940 So without further ado, let's take a look at our road map. 00:30.830 --> 00:36.650 In this section, you're going to learn about errors and error is an indexable collection of elements, 00:37.550 --> 00:42.320 it can only store the same type of values and its length is fixed. 00:43.100 --> 00:45.950 Because of that, errors are very inflexible. 00:46.870 --> 00:52.000 However, they allow us to work with more efficient composite types like slicers. 00:53.050 --> 00:58.340 So after a race, you're going to learn about slices, a slice is just like an array. 00:58.660 --> 01:02.470 However, there is an important difference between an array and a slice. 01:03.190 --> 01:06.460 Unlike an array, a slice can grow and shrink. 01:07.120 --> 01:13.090 So you can add new elements or you can remove existing elements from a slice, but you can do so in 01:13.090 --> 01:13.570 an array. 01:14.480 --> 01:21.920 OK, after slicers, we're going to revisit the strings again, but this time we will go deeper in the 01:21.920 --> 01:26.270 strings are actually bite slices and slices depend on iRace. 01:26.570 --> 01:29.180 So those three are interconnected. 01:29.750 --> 01:32.120 That's why you're going to learn them in this order. 01:33.450 --> 01:39.870 So after you learn everything about shrinks, you're going to learn about maps and map allows us to 01:39.870 --> 01:47.070 fast look up in a collection of values by using a key, it allows us to create more efficient go programs. 01:48.290 --> 01:55.310 And lastly, you're going to learn about stocks, usually a variable can only store one type of value. 01:55.790 --> 01:59.440 On the other hand, Astrachan store different types of values. 02:00.110 --> 02:06.920 It is different than all of these composite types here because it allows us to represent concepts rather 02:06.920 --> 02:08.480 than a series of values. 02:09.140 --> 02:13.510 In addition to that, it doesn't support indexable access to its inner values. 02:14.330 --> 02:19.970 All the other composite literature support access to their elements using index expressions. 02:20.600 --> 02:24.560 Now, let's talk a little bit about what you're going to learn in this section. 02:25.340 --> 02:32.480 First of all, we will start with Vasundhara, things like what an array looks like in computer memory, 02:32.960 --> 02:39.350 how the array type works, and some fundamental properties of arrays that we're going to talk about 02:39.380 --> 02:41.920 how to get and set and arrays, elements. 02:42.410 --> 02:48.050 And after that, we're going to talk about array literals, which, by the way, is an easy way to create 02:48.070 --> 02:49.010 array values. 02:49.400 --> 02:55.310 While we are talking about array literals, we also going to talk about composite literals and there 02:55.310 --> 02:58.250 are differences from other basic data types and so on. 02:59.410 --> 03:03.460 Then we're going to talk about how to compare an assignment era to another era. 03:04.300 --> 03:10.150 We are also going to talk about multidimensional arrays that allow us to create a race within a race. 03:11.020 --> 03:17.560 And after that, we going to talk about how to create a race using the key elements that allow us to 03:17.560 --> 03:20.490 specify index positioning while we are creating an array. 03:21.280 --> 03:25.050 And lastly, we're going to talk about named versus unnamed types. 03:25.690 --> 03:31.120 We're going to get deeper into the go type system further and you're going to learn what an unnamed 03:31.120 --> 03:32.290 type is and so on. 03:32.770 --> 03:35.380 Now, let's talk about the projects that you're going to build. 03:35.800 --> 03:38.860 The first project that we're going to build is called Moodley. 03:39.670 --> 03:42.790 It will show random messages depending on your mood. 03:43.430 --> 03:48.520 For example, let's say I feel good, then I'm going to run the program like this that will print a 03:48.520 --> 03:50.140 positive message like this. 03:51.610 --> 03:57.820 Let's say I don't feel good, then it will display a message like this, it will get these messages 03:57.820 --> 03:58.660 from iRace. 03:59.530 --> 04:04.960 After that, we're going to build a gorgeous command line, digital clock, we're going to animate this 04:04.960 --> 04:10.720 clock so that it will continuously show the current time every second it's going to look like this. 04:12.250 --> 04:17.770 Don, we're also going to animate the separators so that every two seconds they will blink. 04:19.970 --> 04:26.370 OK, let's talk a little bit about why you should use a phrase, by the way, if you already know about 04:26.450 --> 04:28.520 race, you can skip the rest of this video. 04:29.540 --> 04:36.560 All right, so why would you want to use a phrase, instead of simple values in programming, we need 04:36.560 --> 04:41.460 to work with multiple values at the same time without errors. 04:41.480 --> 04:45.530 This can be hard, inefficient and inflexible to work with. 04:46.190 --> 04:47.360 Let me show you what I mean. 04:48.900 --> 04:54.720 For example, let's say you have 1000 different variables and you need to sum them all. 04:55.200 --> 04:55.670 All right. 04:56.220 --> 04:57.180 How can you do that? 04:57.870 --> 05:01.840 Well, you need to add them one by one by hand, right. 05:02.610 --> 05:06.240 However, doing so would be very inefficient and hard. 05:06.420 --> 05:06.840 Right. 05:07.710 --> 05:11.880 Let me show you how you can do the same thing using an array and a loop. 05:13.330 --> 05:19.960 And by the way, as I said, is a composite value, it's called a composite value because it cannot 05:19.960 --> 05:21.900 contain zero or more values. 05:22.630 --> 05:24.570 So we can use a composite value. 05:24.610 --> 05:26.850 You can store multiple values in it. 05:27.800 --> 05:31.820 Here I put these values in a single array variable. 05:32.540 --> 05:35.210 Now it starts 1000 of values in an array. 05:35.870 --> 05:41.180 So instead of creating thousands of variables, I just created a single array value. 05:41.870 --> 05:47.390 Now I can use this array variable and I can sum all the numbers using a simple loop like this. 05:49.860 --> 05:56.790 That's it, is it right, by the way, this is only one of the benefits of using a race, you learn 05:56.790 --> 05:58.380 the rest of them in the section. 05:58.740 --> 05:59.370 No worries. 05:59.700 --> 06:00.280 All right. 06:00.330 --> 06:01.100 That's all for now. 06:01.380 --> 06:02.950 You're going to learn a lot of things. 06:02.970 --> 06:06.080 Again, another exciting journey is about to start. 06:06.300 --> 06:08.200 So see you in the next lecture by.