From: Jeremy Woertink Date: 2007-09-08T04:58:04+09:00 Subject: Re: help me condence my code? Simon Schuster wrote: > putting it into phrase-test.rb and running it that way I get: > > ph-test.rb:3: undefined method `delete_at' for nil:NilClass > (NoMethodError) > from ph-test.rb:10:in `each_with_index' > from ph-test.rb:1:in `each' > from ph-test.rb:1:in `each_with_index' > from ph-test.rb:1 > > and relatedly, going through step by step I get: > > 023:0> end.delete_at(-1) > SyntaxError: compile error > (irb):23: syntax error, unexpected kEND > end.delete_at(-1) > > I've never seen tacking things onto end before! is this possible? hmm, well I guess that means that the delete_at(-1) isn't being called on an array, so the return value of that isn't what I expected. But, to answer the question it is possible to tack things on the end like that. Take that delete_at(-1) off then run it and call f.class, it probably says NilClass, but in the case it says Array, then I don't know back to the books for me :) ~Jeremy -- Posted via http://www.ruby-forum.com/.