* Marvin Gülker <> (2011-12-03) schrieb:
>On 03.12.2011 17:31, Abhilash Nama wrote:
>
>> I am trying to learn to program using Ruby and I have downloaded the
>> Ruby 1.93 installer. My first code is here: http://codepad.org/KlBucAPF
>> but, this doesn't seem to work when I put it in Interactive Ruby on my
>> computer.
>
> "Doesn't work" is quite vague. Can you be more precise, e.g. by posting
> the whole error message you experience?
It works just fine here, I don't see any see any reason why it shouldn't.
,----
| $ irb raw.rb
| raw.rb(main):001:0> class Person
| raw.rb(main):002:1> attr_accessor :name, :gender, :age
| raw.rb(main):003:1> end
| => nil
| raw.rb(main):004:0>
| raw.rb(main):005:0* person1 = Person.new
| => #<Person:0x7ff067f626b0>
| raw.rb(main):006:0> person1.name = "Abhilash Nama"
| => "Abhilash Nama"
| raw.rb(main):007:0> person1.gender = "Male"
| => "Male"
| raw.rb(main):008:0> person1.age = "30"
| => "30"
| raw.rb(main):009:0>
| raw.rb(main):010:0* puts person1.ageraw.rb(main):010:0* raw.rb(main):010:0> 30
| => nil
`----
Using puts in an irb session seems to mess up the output some. But it says 30 on the end the line.
Using ruby, not irb, it just says "30".
mfg, simon .... l