[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Newbie question
From:       Joel VanderWerf <vjoel () path ! berkeley ! edu>
Date:       2007-11-01 21:36:08
Message-ID: 472A46C1.2050309 () path ! berkeley ! edu
[Download RAW message or body]

Dale Smith wrote:
> irb(main):001:0> 1..10.each { |x| puts x }
> NoMethodError: undefined method 'each' for 10:Fixnum
>         from (irb):1
> irb(main):002:0>

The problem is that `..' has lower precedence than `.'.

(1..10).each { |x| puts x }

I often forget the ( ) , and have to back up and insert them.

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic