Changes

Ruby Operators

570 bytes added, 20:40, 18 November 2007
Ruby Assignment Operators
x /= y; # Assigns a value of 2 to variable x (the same as x = x / y)
</pre>
 
== Ruby Comparison Operators ==
 
Comparison operators are used to check for equality between two values. Ruby provides a number of such operators:
 
<table border="1" cellspacing="0">
<tr style="background:#efefef;">
<th>Comparison Operator<th>Description</th>
</tr>
<tr>
<td>==<td>Tests for equality. Returns ''true'' or ''false''</td>
<tr>
<td>.eql?<td>Same as ==.</td>
<tr>
<td><<td>Less than. Returns ''true'' if first operand is less than second operand. Otherwise returns ''false''</td>
<tr>
<td>x *= y<td>x = x * y</td>
<tr>
<td>x %= y<td>x = x % y</td>
</table>