1 00:00:00,600 --> 00:00:01,720 Hello and welcome. 2 00:00:01,740 --> 00:00:11,340 In this election I'm going to go through with you some basic arithmetic operators in Ruby said table 3 00:00:11,370 --> 00:00:15,340 showing some basic arithmetic operators. 4 00:00:15,630 --> 00:00:21,340 That is applicable to the Ruby programming language. 5 00:00:21,360 --> 00:00:30,840 These are the same work the same way with the standard heidrick metric operators saw the addition. 6 00:00:30,840 --> 00:00:38,400 If you want to perform an addition in Ruby you will also use the addition and you can do this Shonin 7 00:00:38,400 --> 00:00:41,630 Ruby by adding strings together. 8 00:00:41,640 --> 00:00:47,660 If you want to add one string to another you can use the addition symbol. 9 00:00:48,060 --> 00:00:55,080 Basically this is some simple example here have a variable called pecs which has a value of 4 and another 10 00:00:55,080 --> 00:01:02,070 variable y is how the value of six and I've got the variables set which I have set to equal to the value 11 00:01:02,070 --> 00:01:08,580 of x plus y and that should give 10 subtraction again the same way. 12 00:01:08,580 --> 00:01:12,810 It will take away similar to the additions example. 13 00:01:13,200 --> 00:01:19,530 Next take away X Y take x or give it to multiplication. 14 00:01:19,650 --> 00:01:21,870 Exactly works the same way. 15 00:01:21,870 --> 00:01:23,780 Multiplication the symbol is. 16 00:01:23,980 --> 00:01:32,600 So if we multiply by by X which is six by four we get 24 division. 17 00:01:32,670 --> 00:01:36,720 Works the same way as the example shows. 18 00:01:36,720 --> 00:01:43,040 The only difference with division when you identify identified in in Group B. 19 00:01:43,320 --> 00:01:44,790 It doesn't it. 20 00:01:44,800 --> 00:01:49,220 It runs up to the nearest number so it doesn't give you a point value. 21 00:01:49,470 --> 00:01:52,470 See if you divide Y which is six by four. 22 00:01:52,500 --> 00:02:00,780 If we return one and then we'll go the model of models is basically it only outport the rumen that what 23 00:02:00,780 --> 00:02:03,280 is left from the Depression. 24 00:02:03,510 --> 00:02:05,270 So again similar example. 25 00:02:05,270 --> 00:02:11,730 Here we are dividing we are doing a more deloss on why next. 26 00:02:11,730 --> 00:02:20,330 Basically what this means is that when you write why by X what is left and the value is to cause way 27 00:02:20,320 --> 00:02:24,300 in sixth form canela going to see X once. 28 00:02:24,350 --> 00:02:26,320 It would give you a remainder of two. 29 00:02:26,430 --> 00:02:27,420 That's what There's value. 30 00:02:27,420 --> 00:02:37,420 If we also got was called an export name and they have the symbol of two esoterics. 31 00:02:37,440 --> 00:02:42,500 So basically what that means people multiply the value by a vat. 32 00:02:42,690 --> 00:02:48,040 So if we value or X which is for and value of y. 33 00:02:48,060 --> 00:02:57,450 Basically what that's saying is that Multiply this by six times out of X it would be four times four 34 00:02:57,450 --> 00:03:00,940 times four times four times for two the power or six. 35 00:03:00,960 --> 00:03:02,560 And that should give you that. 36 00:03:02,560 --> 00:03:10,560 So we can quickly also have a look at these examples in our ruby interactive show and see how it works 37 00:03:10,560 --> 00:03:11,910 out. 38 00:03:12,030 --> 00:03:14,990 So I've got the ruby interactive scale here. 39 00:03:15,000 --> 00:03:25,660 I'm going to start by declaring some variables are a variable X and I always give that value of 4. 40 00:03:26,460 --> 00:03:35,490 Hi will also declare variable y and give it a value of 6 and then I've got the variable Z. 41 00:03:35,520 --> 00:03:46,590 I will set that to equal to the value of x plus y and that she'd give me 10. 42 00:03:46,590 --> 00:03:50,200 Once you've defined variables you can always use it. 43 00:03:50,210 --> 00:03:53,690 I've already defined variables so if I want to call the variable. 44 00:03:53,700 --> 00:04:06,540 If I see variable y take away variable x and is impressed return. 45 00:04:06,540 --> 00:04:07,580 That would give me the value. 46 00:04:07,650 --> 00:04:17,190 So the value is too far I want to multiply variable y times variable x. 47 00:04:17,370 --> 00:04:19,220 That should give me 24. 48 00:04:19,650 --> 00:04:24,980 If I want to Vi variable y. 49 00:04:25,680 --> 00:04:29,860 Divide by variable x that should return 1. 50 00:04:30,660 --> 00:04:38,550 If I want to do it more deloss I want a return value. 51 00:04:38,580 --> 00:04:50,280 Once the division is taking place for example 5 1 the result when you divide Y my X that should give 52 00:04:50,280 --> 00:04:55,460 me a value of two class the remember is called modal loss. 53 00:04:55,470 --> 00:04:57,500 Finally it would do one more test. 54 00:04:57,510 --> 00:04:59,280 I am going to. 55 00:05:00,250 --> 00:05:01,660 To an exponential. 56 00:05:01,660 --> 00:05:07,140 I am going to do X times has terik as to X Y. 57 00:05:07,380 --> 00:05:11,390 What this means is that it means for. 58 00:05:12,220 --> 00:05:17,700 You must apply for six times four times four times four times four and so on. 59 00:05:17,710 --> 00:05:21,780 And that you give you value or 4 0 9 6. 60 00:05:21,970 --> 00:05:28,790 So these are big arithmetic operators that you can use in Ruby. 61 00:05:28,810 --> 00:05:30,910 Many thanks for watching by phone.