I'm looking at the Comparable module in a book, and I can't figure out
how to do a simple comparison. What I want to do is a loop based on a
counter. If the counter is less than 3, I want to execute the loop,
otherwise I want the loop to end. I'm used to coding something like if
$cnt < 3 but in Ruby that doesn't seem to work. Obviously I'm new to OO
programming, so can someone give me a simple example of how to do this,
or point me to a simple tutorial on how to do comparisons?
Thanks
I'm looking at the Comparable module in a book, and I can't figure out
how to do a simple comparison. What I want to do is a loop based on a
counter. If the counter is less than 3, I want to execute the loop,
otherwise I want the loop to end. I'm used to coding something like if
$cnt < 3 but in Ruby that doesn't seem to work. Obviously I'm new to OO
programming, so can someone give me a simple example of how to do this,
or point me to a simple tutorial on how to do comparisons?
Thanks
2007/10/16, Peter Vanderhaden <bostonantifan@yahoo.com>:
I'm looking at the Comparable module in a book, and I can't figure out
how to do a simple comparison. What I want to do is a loop based on a
counter. If the counter is less than 3, I want to execute the loop,
otherwise I want the loop to end. I'm used to coding something like if
$cnt < 3 but in Ruby that doesn't seem to work. Obviously I'm new to OO
programming, so can someone give me a simple example of how to do this,
or point me to a simple tutorial on how to do comparisons?