This example demonstrates the if else statements in Ruby.
Sequence ranges in Ruby are used to create a range of successive values - consisting of a start value, an end value and a range of values in between.
Following logical operators are supported by Ruby language:
and => Called Logical AND operator. If both the operands are true then then condition becomes true.
Ruby supports a rich set of operators, as you'd expect from a modern language. Most operators are actually method calls.
Constants are like variables, except that you are telling Ruby that their value is supposed to remain fixed. If you try to change the value of a constant, Ruby will give you a warning.
You can manipulate variables in exactly the same way that you would manipulate the objects that they represent.
A variable is a name that Ruby associates with a particular object.
In Ruby, we do not need to define a variable. We can create a new variable with any name by assigning a value to it.
Difference (-) creates a new array, removing elements that appear in both arrays.
Intersection (&) creates a new array, merging the common elements of two arrays but removing uncommon elements and duplicates.