Ruby

33
1330 reads

February 7, 2013

if else statements


This example demonstrates the if else statements in Ruby.

25
1210 reads

February 5, 2013

Range operators


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.

39
1191 reads

February 5, 2013

Logical Operators


Following logical operators are supported by Ruby language:

and => Called Logical AND operator. If both the operands are true then then condition becomes true.

24
1237 reads

February 5, 2013

Ruby Arithmetic Operators


Ruby supports a rich set of operators, as you'd expect from a modern language. Most operators are actually method calls.

24
1297 reads

February 1, 2013

Constants vs Variables


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.

23
1382 reads

February 1, 2013

Working with variables


You can manipulate variables in exactly the same way that you would manipulate the objects that they represent.

40
1452 reads

February 1, 2013

Introduction


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.

102
1207 reads

January 24, 2013

Union of arrays


Union (|) joins two arrays together, removing duplicates.

192
3170 reads

January 24, 2013

Difference of arrays


Difference (-) creates a new array, removing elements that appear in both arrays.

192
2669 reads

January 24, 2013

Intersection of arrays


Intersection (&) creates a new array, merging the common elements of two arrays but removing uncommon elements and duplicates.