On Mon, Mar 24, 2008 at 10:02 AM, Peter Johnsson <avokadoret / gmail.com> wrote:
> Thank you for all of your responses. I'm sorry for being so slow with
>  responding, but you guys have given me a lot of helpful information so
>  I've been trying to focus on looking at your examples as well as
>  understanding them. I'll keep reading  and try to make sure I get it
>  right at last. Thanks a lot, you've helped me very much!

Here's a weird one that won't help you that much.  It's just for fun.
You can separate 1, 0, and other integers with 1 / i.  For example...

[0, 1, 2, 3, 4, 5].reverse.map! {|i| ((1 / i).zero? ? "a" : "b" rescue "c")}

=> ["a", "a", "a", "a", "b", "c"]

Why would you do it this way?  Well, you probably wouldn't.  You'd be
just fine with if/then/elsif/else and case constructs, not to mention
this strange use of "rescue" for a conditional predicate.

To the OP, you definitely are on the right track!  Just remember that
Ruby has some behind-the-scenes methods that do this type of work for
you.

Todd