Changes

Jump to: navigation, search

Ruby Flow Control

13 bytes removed, 13:00, 1 December 2007
Using else and elsif Constructs
As shown in the above example the code block following the ''if'' statement is executed when the expression is evaluated to be true (i.e the customerName variable contains the string "Fred") and the script after the ''else'' statement is executed when the customerName does not match the string "Fred".
''elsif'' structures take the ''if ... else ...'' concept a step taken a step further to implement ''if ... else ... if ... else ...'' structures. For example:
<pre>

Navigation menu