1 00:00:00,570 --> 00:00:02,770 Hello and welcome to this lecture. 2 00:00:02,820 --> 00:00:11,360 In this chair I'll be explaining to you what race are in the Ruby programming language. 3 00:00:11,910 --> 00:00:21,830 What is an eerie and horray basically is an ordered into jeered in the next collection of objects. 4 00:00:22,080 --> 00:00:25,640 Let me quickly explain what I mean by that. 5 00:00:25,860 --> 00:00:29,190 Okay so he says there is an audit. 6 00:00:29,220 --> 00:00:40,080 What that means is that the way the objects of variables are arranged inside an array they are all you 7 00:00:40,080 --> 00:00:41,280 can think of an array. 8 00:00:41,280 --> 00:00:43,880 For example has a storage box. 9 00:00:43,920 --> 00:00:48,160 See if you've got a storage container that has different compartments. 10 00:00:48,390 --> 00:00:55,920 And the first copper compartment you've got maybe close second compartment you've got icecream and so 11 00:00:55,920 --> 00:01:02,970 on the way the compartments are the way you've placed the various object that is the way they are going 12 00:01:02,970 --> 00:01:05,030 to be all that that is worth. 13 00:01:05,040 --> 00:01:12,180 That's what he means by ordered and they order based on numbers and the very first object inside that 14 00:01:12,180 --> 00:01:16,910 container is given an integer indexed of zero. 15 00:01:16,980 --> 00:01:25,470 This second object is given one answer Launce the very first object has an integer indexed value of 16 00:01:25,710 --> 00:01:26,350 zero. 17 00:01:26,490 --> 00:01:37,170 So if you want to reference it you're referencing Phi its index an array can store multiple value objects 18 00:01:37,290 --> 00:01:45,420 as one in comparing two variables than just times once so Larry can store multiple Veau variables has 19 00:01:45,510 --> 00:01:51,200 one value and then three can be identified by square brackets. 20 00:01:51,210 --> 00:01:55,640 When you define an array you have to give it square brackets. 21 00:01:55,660 --> 00:02:02,590 That's the only way Ruby can tell that you are dealing or dealing with an array. 22 00:02:02,940 --> 00:02:06,320 When the re is defined you can have an entity. 23 00:02:06,560 --> 00:02:12,770 I mean you just define it and nothing in there and then later on you can add values to it. 24 00:02:12,780 --> 00:02:19,740 So if you know what your defining ellerey Aina was going to be inside it's best you just add the values 25 00:02:19,950 --> 00:02:21,970 as you create them. 26 00:02:21,990 --> 00:02:29,520 Hillary can also contain a mix of things so you can have an array that has put integer and strings or 27 00:02:29,520 --> 00:02:36,650 just strings or just integers arrays can also have other arrays contained. 28 00:02:37,350 --> 00:02:40,070 Let's create a very simple Hurry. 29 00:02:40,100 --> 00:02:47,990 I'm going to create an I record name right so on calling names. 30 00:02:48,400 --> 00:02:51,780 I'm going to a course to add re. 31 00:02:52,020 --> 00:02:53,280 Because I'm dealing with names. 32 00:02:53,280 --> 00:02:56,550 There is the string so I've got to enclose them in quotes. 33 00:02:56,550 --> 00:03:00,360 I'm going to give the names first name. 34 00:03:00,360 --> 00:03:02,570 I'm going to say Anna 35 00:03:05,530 --> 00:03:10,580 and you separate the values with a comma stuck on them. 36 00:03:10,750 --> 00:03:11,790 See James 37 00:03:18,450 --> 00:03:20,260 third name. 38 00:03:20,370 --> 00:03:22,900 I give you a Lou see. 39 00:03:26,470 --> 00:03:27,250 Third name. 40 00:03:27,250 --> 00:03:30,250 I was saying Andy. 41 00:03:32,750 --> 00:03:41,300 And then I'll close the square brackets so I now have a Larry that has four objects in it and the indexed 42 00:03:41,420 --> 00:03:43,470 is free. 43 00:03:43,490 --> 00:03:47,390 So this first of all have an index integer index of zero. 44 00:03:47,390 --> 00:03:49,600 This will be one two three. 45 00:03:49,730 --> 00:03:54,740 So you can access members of the Arri by their indexed value. 46 00:03:55,190 --> 00:03:59,820 So if I press enter it tells me I have got a low rate of four. 47 00:03:59,840 --> 00:04:09,250 So if I on a list the Arri and just type inputs followed by the name of the Harry which is names. 48 00:04:09,470 --> 00:04:12,570 Press Centre and it'll give me a list. 49 00:04:12,920 --> 00:04:19,680 If I wanted to access an individual member of that array they were I would do that. 50 00:04:19,670 --> 00:04:26,090 I just called the irey by name which is names and the square brackets say I want it to access. 51 00:04:26,180 --> 00:04:27,090 Lucy. 52 00:04:27,440 --> 00:04:30,540 Lucy will be in there X number two. 53 00:04:30,620 --> 00:04:32,680 This is 0 1 2. 54 00:04:32,930 --> 00:04:34,780 I just put 2 in there. 55 00:04:35,150 --> 00:04:37,550 Close the square bracket and press enter. 56 00:04:37,670 --> 00:04:41,070 It would give me the value of Lucy. 57 00:04:41,300 --> 00:04:44,080 Moses got the quotes there because I didn't use it. 58 00:04:44,080 --> 00:04:47,060 Put it fine to put. 59 00:04:47,220 --> 00:04:57,010 Followed by planes and square bracket to give me Lucy without the quotes. 60 00:04:57,080 --> 00:05:02,810 So that's how you access her remember so if you wanted access acts as individual members of an array 61 00:05:03,310 --> 00:05:06,650 you'd do that using it indexed value. 62 00:05:07,040 --> 00:05:13,940 So that's it for this basic introduction to hari's in the Ruby programming language. 63 00:05:14,210 --> 00:05:16,020 Many thanks for watching. 64 00:05:16,080 --> 00:05:17,140 Bye for now.