From: Anand Maheswar Date: 2000-12-10T14:40:02+09:00 Subject: [ruby-talk:6997] Re: output problem Thanks to both of you! Well, that was a silly of me, eh? In my defense, I'm going through Thomas/Hunt book (which is excellent) and there are instances of expressions with their output like aSong.duration --> 257. I thought that this was all that was required semantically to output to stdout. Thanks for getting back on track. I'm having a lot of fun with Ruby! Anand "Mark Slagell" wrote in message news:3A32767C.69A147C3@iastate.edu... > Anand Maheswar wrote: > > ... > > When I enter the following program into irb it works as expected, but when > > run from the command line just returns me to my prompt--i.e., no output > > whatsoever. I running Ruby 1.6.1 under window 2000 using a cygwin bash > > shell. > > > > class Test > > def initialize(numbers,numberPossible) > > @numbers = numbers > > @numberPossible = numberPossible > > end > > attr_reader :numbers, :numberPossible > > attr_writer :numbers, :numberPossible > > end > > l = Test.new(6,54) > > l.numbers > > l.numberPossible > > > > > > Anand, > > irb displays as it evaluates--which is behavior you probably wouldn't > want in general for all your programs. Explicitly print what you want > to see. (use print, printf, puts, p, or whatever). > > Welcome - I hope you like ruby as you get familiar with it. > > Mark