From: Dark Ambient Date: 2006-07-07T20:28:33+09:00 Subject: Question : Pickaxe example I'm reading through part 1, blocks and iterators section. Lots to digest here :) Anyway, there is discussion about implementing a search for songs, called 'with_title' Even though the first code example is not the one that ultimately gets used I think for me it's important to understand it, so I tried recreating it outside the actual application. I'm getting some errors and would appreciate some feedback. Here is the code (I've used some puts statements to see what's going on) def with_title (title) myarray = ['Ruby Tuesday', 'Paint it Black', 'Lets Spend the Night Together', 'Mothers Little Helper', 'Jumpin Jack Flash'] for i in 0...myarray.length puts myarray.length # added in to debug puts 'here is i: ' + i.to_s # added in to debug return myarray[i] if title == myarray[i].title #leaving .title in causes an error #about undefined method puts 'here is myarray[i] ' + myarray[i] end end with_title('Paint it Black') If in this line return myarray[i] if title == myarray[i].title <------ I removed the .title from the right side of the equality statement, myarray[i] I get this back: 5 here is i: 0 here is myarray[i] Ruby Tuesday 5 here is i: 1