![]() Modulus AND assignment operator, takes modulus using two operands and assign the result to left operand.Įxponent AND assignment operator, performs exponential (power) calculation on operators and assign value to the left operand. Multiply AND assignment operator, multiplies right operand with the left operand and assign the result to left operand.ĭivide AND assignment operator, divides left operand with the right operand and assign the result to left operand. Subtract AND assignment operator, subtracts right operand from the left operand and assign the result to left operand. Simple assignment operator, assigns values from right side operands to left side operand.Ĭ = a b will assign the value of a b into cĪdd AND assignment operator, adds right operand to the left operand and assign the result to left operand. If aObj is duplicate of bObj then aObj = bObj is true, a.equal?bObj is false but a.equal?aObj is true. True if the receiver and argument have the same object id. True if the receiver and argument have both the same type and equal values.ġ = 1.0 returns true, but 1.eql?(1.0) is false. Used to test equality within a when clause of a case statement. Returns 0 if first operand equals second, 1 if first operand is greater than the second and -1 if first operand is less than the second. Modulus − Divides left hand operand by right hand operand and returns remainder.Įxponent − Performs exponential (power) calculation on operators.Ĭhecks if the value of two operands are equal or not, if yes then condition becomes true.Ĭhecks if the value of two operands are equal or not, if values are not equal then condition becomes true.Ĭhecks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.Ĭhecks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.Ĭombined comparison operator. Multiplication − Multiplies values on either side of the operator.ĭivision − Divides left hand operand by right hand operand. Subtraction − Subtracts right hand operand from left hand operand. Ruby Arithmetic OperatorsĪssume variable a holds 10 and variable b holds 20, then − OperatorĪddition − Adds values on either side of the operator. For example, a b is interpreted as a. (b), where the method in the object referred to by variable a is called with b as its argument.įor each operator ( - * / % **
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |