Ruby

30
1295 reads

March 5, 2013

Case with Strings


You can also use non-integer types such as string. If multiple trigger values are specified in a when section, they may be of varying types – for example, both string and integers:

40
1288 reads

March 5, 2013

More on Case


Working with Case Statement

32
1425 reads

March 5, 2013

Case Break


Learn how to break to get specific output.

37
1185 reads

March 5, 2013

Case Statement


When you need to take a variety of different actions based on the value of a single variable, multiple if..elsif tests are verbose and repetitive.

31
1220 reads

March 5, 2013

Boolean Operators


and &&
These operators evaluate the left-hand side then, only if the result is true, they evaluate the right-hand side; and has lower precedence than &&

or ||

24
1293 reads

March 5, 2013

Wrong Use of and or


This Example tell how not to use the and or operator as it does not give correct results every time.

40
1461 reads

March 5, 2013

and or


Learn how to use and and or Operator in Ruby

24
1275 reads

March 4, 2013

Using Upto and Downto


Using Upto and Downto continuous loop

21
1222 reads

March 4, 2013

Using Until


Ruby also has an until loop which can be thought of as a ‘while not’ loop.

28
1095 reads

March 4, 2013

Create An Array Using Two Sub-arrays


An array with two sub-arrays - i.e. 2 'rows' each with 4 elements