WEBVTT 00:00.440 --> 00:01.420 Welcome back. 00:01.760 --> 00:07.370 In the second step, I'm going to explain how are we going to print the clock by using the current time 00:07.370 --> 00:09.950 and the digits that we have created in the last lecture. 00:10.340 --> 00:11.660 OK, let's get started. 00:12.880 --> 00:15.190 All right, let's take a look at the goals first. 00:16.530 --> 00:18.550 I have these four goals, right? 00:18.870 --> 00:23.610 First, I'm going to get the current time, then I'm going to separate it into over a minute and second 00:23.610 --> 00:28.950 values, then I'm going to create the clocker by getting them from the digits area that I created in 00:28.950 --> 00:29.730 the last lecture. 00:30.090 --> 00:31.800 And then I'm going to print the clock. 00:31.980 --> 00:33.510 It will display the current time. 00:33.570 --> 00:38.160 And lastly, I'm going to add the separators between the hour, minute and seconds. 00:38.670 --> 00:39.090 All right. 00:39.090 --> 00:40.590 Let's start with the first goal, the. 00:41.600 --> 00:46.500 Our first goal is simple, getting the current time, you have to do it already, right? 00:47.240 --> 00:53.210 Let me first declare a variable like so then I'm going to call the time that now function to get the 00:53.210 --> 00:54.710 current time like this. 00:55.480 --> 00:55.940 All right. 00:56.480 --> 01:01.630 Now, variable contains a time type which in turn stores the current time. 01:02.300 --> 01:05.600 Let's use it to get the current hour, minute and second. 01:05.720 --> 01:08.650 OK, now I'm going to declare three variables. 01:08.810 --> 01:09.320 Our. 01:10.500 --> 01:18.000 Mean and sick, OK, now I'm going to get the current hour by using the our method of the time type 01:18.000 --> 01:18.690 like this. 01:19.630 --> 01:25.460 As you know now, variables type is time and the time type has a Arber method. 01:26.260 --> 01:31.180 OK, now I'm going to get the current minute and lastly, I'm going to get this second. 01:32.170 --> 01:35.200 OK, let me print them so you can see what they are storing. 01:40.710 --> 01:42.570 OK, cool. 01:42.840 --> 01:44.030 I'm going to use this soon. 01:44.550 --> 01:45.910 Let's check out the girls again. 01:46.770 --> 01:48.340 OK, I've finished the first go. 01:48.510 --> 01:50.190 Let me check it off from the list. 01:51.870 --> 01:54.050 The next thing is creating the clocker. 01:54.240 --> 01:54.870 Let's do that. 01:55.680 --> 02:01.650 But before that, let's remember the clock erra again to print this clock, I need to start the digits 02:01.650 --> 02:04.200 in a multidimensional array called the clock. 02:04.840 --> 02:11.580 Remember, it has eight placeholders, six of them four digits, and two of them for the separators. 02:11.790 --> 02:15.600 As you can see, each placeholder is an array of five strings. 02:16.580 --> 02:18.230 Just like the digitizers. 02:20.360 --> 02:25.100 And the yellow lines represent the placeholder elements, which are string values. 02:25.760 --> 02:27.560 All right, let's create this aura. 02:29.150 --> 02:34.940 Now I'm going to declare a clock variable, then I'm going to type the length of the error using ellipses, 02:35.690 --> 02:38.960 and lastly, I'm going to type the element type as placeholder. 02:40.090 --> 02:45.790 So after I finish, this will be a multidimensional array with a placeholder elements like this. 02:47.420 --> 02:52.910 I'm going to fill it with the fake digits for now so that I can explain it to you how it's going to 02:52.910 --> 02:53.190 work. 02:53.210 --> 02:57.220 OK, here I'm filling it with digits arrays randomly. 02:57.740 --> 03:00.200 These are just fake data for now, of course. 03:00.560 --> 03:02.070 OK, I created the clock. 03:02.630 --> 03:05.000 The next goal is printing the clock. 03:05.240 --> 03:05.960 Let's do that. 03:07.620 --> 03:12.450 Here in this loop, instead of printing the digits, using the digits there, now, I'm going to get 03:12.450 --> 03:13.750 them from the clocks, right? 03:14.460 --> 03:17.850 This is because the clock array will contain the current time. 03:18.220 --> 03:19.530 I can use the same loop. 03:20.020 --> 03:22.560 OK, so now I'm going to change. 03:22.560 --> 03:26.250 All the digits are easier to clocks, arrays like this. 03:26.940 --> 03:31.220 Now the loop gets the digits from the clocks array instead of the digits array. 03:31.500 --> 03:36.180 OK, I had used the digits array only to print the digits. 03:36.240 --> 03:37.950 Now it will print the actual clock. 03:38.940 --> 03:39.630 That's right. 03:40.460 --> 03:44.870 As you can see, it prints the digits that are put into the clocks are right. 03:45.240 --> 03:50.670 If you look at the indexes that I've used here, you can see that it brings the clock that is equal 03:50.670 --> 03:51.540 to the indexes. 03:51.990 --> 04:01.830 For example, digits one prints one digits, zero prints zero digits, two prints, two digits, three 04:01.830 --> 04:03.270 brains, three and so on. 04:03.300 --> 04:07.050 So just by using the indexes, I can print any digit like this. 04:08.520 --> 04:12.630 OK, now, instead of printing random digits, let's print the current time. 04:13.260 --> 04:15.000 Let's start with the current hour. 04:15.390 --> 04:17.970 Let me first delete the rest of the digits first. 04:18.630 --> 04:23.600 OK, now I'm going to get the first digit of the current hour like this here. 04:23.610 --> 04:25.520 I divided the hour by 10. 04:25.980 --> 04:28.860 So this will return the first digit of the current hour. 04:28.920 --> 04:32.760 OK, then I'm going to get the second digit of the current hour like this. 04:33.600 --> 04:35.250 Let me show you what it looks like. 04:35.700 --> 04:36.170 Cool. 04:36.210 --> 04:39.410 It brings the current hour in nice retro digits. 04:39.600 --> 04:44.370 So when you divide an integer number with 10, it will give you its first digit. 04:44.580 --> 04:47.770 This is because an integer doesn't have a fractional part. 04:47.790 --> 04:51.990 So here it returns one because 12 divided by 10 is one. 04:52.740 --> 04:55.470 And then use the remainder operator like this. 04:55.470 --> 04:58.590 It will give you the remainder after the division by 10. 04:59.040 --> 05:04.230 So here it returns two because the remainder of 12 by 10 is two. 05:05.390 --> 05:08.870 OK, it is time to print the digits for the current minute. 05:09.590 --> 05:16.190 I'm going to duplicate this line that I'm going to change to our variables with the mean variables. 05:16.680 --> 05:17.510 Let's try it. 05:18.600 --> 05:23.430 As you can see for the current minute here at Prince, four to five, it is correct. 05:23.910 --> 05:27.140 OK, let's do the same thing for the current second. 05:27.720 --> 05:29.370 I'm going to duplicate this line. 05:30.330 --> 05:34.260 Then I'm going to change the many variables with the SEC variables. 05:34.860 --> 05:40.910 OK, let's try, as you can see, for the current seconds, it preens 18, which is correct. 05:41.870 --> 05:42.250 Cool. 05:42.440 --> 05:45.230 Our club is ready and it shows the current time. 05:45.520 --> 05:46.880 Let's check out the goals again. 05:47.540 --> 05:48.010 All right. 05:48.020 --> 05:51.230 I print the clock, so let me check this goal off. 05:51.500 --> 05:53.650 Let's take a look at the next goal, OK? 05:53.690 --> 05:56.720 Has the last goal I need to at the separators. 05:56.940 --> 05:57.740 Let's get started. 05:58.250 --> 06:03.080 OK, now I'm going to create another placeholder called the column like this. 06:03.410 --> 06:09.200 This where you will store the separator between the hours, minutes and seconds. 06:09.230 --> 06:13.150 OK, now I'm going to add five string elements to it here. 06:13.160 --> 06:15.950 I'm going to add this box character right here. 06:16.610 --> 06:17.690 Then another one here. 06:18.260 --> 06:20.480 It looks like a separator, right? 06:20.810 --> 06:28.220 Because it is now I'm going to put this separator into the clock right between the hour minute and the 06:28.220 --> 06:31.400 second Lexar and another one here. 06:31.940 --> 06:33.700 OK, let's try. 06:35.020 --> 06:35.450 Cool. 06:35.470 --> 06:38.500 Right now, it really looks like a real clock, isn't it? 06:39.250 --> 06:41.300 All right, let's check out the girls again. 06:41.830 --> 06:43.810 Let me check off the last girl as well. 06:44.170 --> 06:44.680 All right. 06:44.680 --> 06:47.230 Let's take a quick break here in the next lecture. 06:47.260 --> 06:48.740 I'm going to animate the clock. 06:48.760 --> 06:49.470 See you there. 06:49.560 --> 06:49.840 Oh, I.