On Tue, Jul 28, 2009 at 12:15 PM, RichardOnRails<RichardDummyMailbox58407 / uscomputergurus.com> wrote: > Hi,, > > I putting together examples I might use in teaching an elementary Ruby > seminar. for the moment, I like to code examples inside a method that > displays both the code and the result of the code's execution. > > I pasted both the code and the output presented by running the code > under SciTE at http://www.pastie.org/561156. > > My problem is the spurious final line of output from the show method: > "1256921" from Example 4. I like to learn why that's generated so > that I can eliminate it. I repeated the Example 4 code out of the > "show" context, and it executed as I expected, i.e. no "1256921" ws > generated. > > Any ideas? > > Thanks in Advance, > Richard > > I don't know if this totally fixes your problem, but take a look at this. def show(stmt) puts stmt puts "=> " eval(stmt).to_s # Remove the puts puts end Harry -- A Look into Japanese Ruby List in English http://www.kakueki.com/ruby/list.html