| CIT 597 Quiz 8: Ruby | |
| Fall 2008, David Matuszek | Name_________________________________________ |
case statement differs semantically (that is, ignoring syntax differences) from Java's switch statement. if statements
sometimes need parentheses around the condition. if statements sometimes use the word then.1..5 includes the value 5. [1..5] denotes an array with more than one element. a = [1, 2, 3], then a[500] = 'hello' is a valid statement. if is used as a statement suffix, end is not required. each iterator
to print out all the elements of the array a, one per
line. catch
and finally? rescue and ensure x = 12
def foo; x = 8; yield; end 12
foo {
puts x } chopchompchomp!