1 00:00:14,890 --> 00:00:19,450 Hello and welcome to the golden programming language course in this session. 2 00:00:19,630 --> 00:00:22,360 We want to talk about the other areas concepts. 3 00:00:28,050 --> 00:00:37,620 Iterate over and add a you can iterate over and add a elements in different ways for loop, for accessing 4 00:00:37,620 --> 00:00:41,760 great elements, range for accessing added elements. 5 00:00:43,450 --> 00:00:47,400 Rains for accessing every element and do not display index. 6 00:00:49,060 --> 00:00:51,940 And range in Lou, as if look. 7 00:00:53,370 --> 00:00:58,500 First, we want to talk about for Loop, for accessing added elements. 8 00:00:59,010 --> 00:01:05,940 Now go to Waskow and illustrate how to use Falou first, clear the last quote. 9 00:01:08,750 --> 00:01:20,020 Save the project defined an 80 and initialize it, for the example, in Annie Hall and equals S-Corp 10 00:01:20,020 --> 00:01:28,460 bracket set five value for the length of edit and end for the type of array and calibre rockets and 11 00:01:28,460 --> 00:01:34,940 initialize the value one two, three four and comma fine. 12 00:01:39,030 --> 00:01:41,940 Now display the values of an eight by four loop. 13 00:01:45,790 --> 00:02:01,750 Formed by calling equals zero I less than Len and I four create the condition for loop you can use from 14 00:02:01,750 --> 00:02:12,240 length of arable land function and then I plus plus display that anybody by index. 15 00:02:12,250 --> 00:02:21,630 So write these codes FP and add a high school breakfast and sit. 16 00:02:21,640 --> 00:02:26,190 I very well here for return the value of each index. 17 00:02:27,310 --> 00:02:32,530 Save the projects and execute the code first. 18 00:02:32,530 --> 00:02:34,060 Go to the project folder. 19 00:02:34,060 --> 00:02:38,350 See the array and draw on the project. 20 00:02:42,670 --> 00:02:44,710 Now we can see the output. 21 00:02:44,950 --> 00:02:51,850 In this case, one unit is added each time by A-plus, plus plants and fish to add eight elements value 22 00:02:51,850 --> 00:02:56,920 by access to index of it, and we could iterate between added elements. 23 00:02:58,070 --> 00:03:06,020 Now go to a slide and continue in this case, we want to talk about range for accessing added elements 24 00:03:06,410 --> 00:03:12,920 and range for accessing added elements without index and range info low as a view. 25 00:03:18,250 --> 00:03:18,760 Range. 26 00:03:20,420 --> 00:03:27,980 The foreign statements supports one additional form that uses the key word range to iterate over the 27 00:03:27,980 --> 00:03:36,650 next version that evaluates to an array a slice map extreme or Channon range victory, and this slices 28 00:03:36,650 --> 00:03:39,950 it returns the index of the item as integer. 29 00:03:40,430 --> 00:03:48,080 With maps, it returns the key of the next key value chain and range either returns one value or two. 30 00:03:48,380 --> 00:03:54,230 You can see the syntax index is the index of the value we are accessing. 31 00:03:54,710 --> 00:04:03,530 Value is the actual value you have on each iteration, and data holds the data structure whose values 32 00:04:03,530 --> 00:04:05,030 will be accessed in the loop. 33 00:04:06,050 --> 00:04:10,190 Now go to the school and do some example. 34 00:04:11,200 --> 00:04:22,600 First, Hillier, the last call and comment this followed and iterate these very bad by the arrange 35 00:04:23,380 --> 00:04:24,070 for. 36 00:04:25,820 --> 00:04:29,420 Index common value. 37 00:04:31,210 --> 00:04:38,170 Column he calls Ranj name of variable in array. 38 00:04:41,960 --> 00:04:47,180 And display each element by index and value of FP. 39 00:04:52,060 --> 00:04:52,870 Index. 40 00:05:00,630 --> 00:05:06,250 And Value said the project executed the cold. 41 00:05:09,480 --> 00:05:17,100 Now we can see the output and we could display each element of at a Y index and value. 42 00:05:20,190 --> 00:05:30,150 In today, we can display just value by Iranians in follow up and do not display in their 40s or sit 43 00:05:30,150 --> 00:05:34,170 on the score instead of index and solely print the value. 44 00:05:35,320 --> 00:05:40,270 Now, clearest in the last full comment, this court 45 00:05:44,890 --> 00:05:57,700 and to the following fall, instead of index, we sit on the risk for common value calling equals ranj 46 00:06:00,370 --> 00:06:11,590 abbreviated entry and print, a value worth p value. 47 00:06:14,080 --> 00:06:16,630 Save the project and execute the code. 48 00:06:21,200 --> 00:06:32,360 Now we can see the output, the value of each element has created one two three four five and they could 49 00:06:32,360 --> 00:06:38,240 display the value of each element without index by the range. 50 00:06:41,260 --> 00:06:46,390 In the fourth day, we can use the range info loop as a viable loop. 51 00:06:48,400 --> 00:06:51,970 Now here is screen comment, this court 52 00:06:57,340 --> 00:07:04,870 and right there range in loop as a wire loop first define a very idea like J Call it equals zero is 53 00:07:04,870 --> 00:07:18,340 as a counter and create a followed by range, full range and name or variable inside a display the value 54 00:07:18,340 --> 00:07:20,560 of any in each iteration. 55 00:07:21,550 --> 00:07:21,880 FP 56 00:07:24,900 --> 00:07:37,510 inside a briefcase and set j variable here for which the variable value and after each iteration plus 57 00:07:37,510 --> 00:07:44,800 plus JW Marriott and J Plus Plus Deformity Code said the project can execute the code. 58 00:07:46,870 --> 00:07:54,350 Now we can see the output one, two, three, four five, and we could use the range in follow up advice, 59 00:07:54,370 --> 00:08:00,310 look, in order not to prolong the time of this session, we will finish it and we will continue the 60 00:08:00,310 --> 00:08:02,170 content in the next session. 61 00:08:02,380 --> 00:08:02,920 Goodbye.