From: matz@... (Yukihiro Matsumoto) Date: 2001-03-16T16:16:40+09:00 Subject: [ruby-talk:12721] Re: FEATURE REQUEST: 'my' local variables Hi, In message "[ruby-talk:12718] Re: FEATURE REQUEST: 'my' local variables" on 01/03/16, "Doug Edmunds" writes: |code snippet1: | |animal = %w( cat dog cow duck ) |vegetable = %w( tomato carrot onion ) |vegetable.each { |animal| puts animal } |p 'now animal is: ', animal # result is 'onion'!!! I think the problem is you were assigning vegetables to the variable named "animal". I think you don't complain int i; i = 22; for (i=0; i<10; i++) { printf("i=%d\n", i); } printf("i=%d\n", i); /* result is 9!! */ And my fault was |animal| in {|animal| puts animal } seems like a declaration which was not. It's just an assignment to the loop variable. matz.