Hello and welcome.
In this election I'm going to go through with you some basic arithmetic operators in Ruby said table
showing some basic arithmetic operators.
That is applicable to the Ruby programming language.
These are the same work the same way with the standard heidrick metric operators saw the addition.
If you want to perform an addition in Ruby you will also use the addition and you can do this Shonin
Ruby by adding strings together.
If you want to add one string to another you can use the addition symbol.
Basically this is some simple example here have a variable called pecs which has a value of 4 and another
variable y is how the value of six and I've got the variables set which I have set to equal to the value
of x plus y and that should give 10 subtraction again the same way.
It will take away similar to the additions example.
Next take away X Y take x or give it to multiplication.
Exactly works the same way.
Multiplication the symbol is.
So if we multiply by by X which is six by four we get 24 division.
Works the same way as the example shows.
The only difference with division when you identify identified in in Group B.
It doesn't it.
It runs up to the nearest number so it doesn't give you a point value.
See if you divide Y which is six by four.
If we return one and then we'll go the model of models is basically it only outport the rumen that what
is left from the Depression.
So again similar example.
Here we are dividing we are doing a more deloss on why next.
Basically what this means is that when you write why by X what is left and the value is to cause way
in sixth form canela going to see X once.
It would give you a remainder of two.
That's what There's value.
If we also got was called an export name and they have the symbol of two esoterics.
So basically what that means people multiply the value by a vat.
So if we value or X which is for and value of y.
Basically what that's saying is that Multiply this by six times out of X it would be four times four
times four times four times for two the power or six.
And that should give you that.
So we can quickly also have a look at these examples in our ruby interactive show and see how it works
out.
So I've got the ruby interactive scale here.
I'm going to start by declaring some variables are a variable X and I always give that value of 4.
Hi will also declare variable y and give it a value of 6 and then I've got the variable Z.
I will set that to equal to the value of x plus y and that she'd give me 10.
Once you've defined variables you can always use it.
I've already defined variables so if I want to call the variable.
If I see variable y take away variable x and is impressed return.
That would give me the value.
So the value is too far I want to multiply variable y times variable x.
That should give me 24.
If I want to Vi variable y.
Divide by variable x that should return 1.
If I want to do it more deloss I want a return value.
Once the division is taking place for example 5 1 the result when you divide Y my X that should give
me a value of two class the remember is called modal loss.
Finally it would do one more test.
I am going to.
To an exponential.
I am going to do X times has terik as to X Y.
What this means is that it means for.
You must apply for six times four times four times four times four and so on.
And that you give you value or 4 0 9 6.
So these are big arithmetic operators that you can use in Ruby.
Many thanks for watching by phone.