Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Beginner to Ruby

Reply
Thread Tools

Beginner to Ruby

 
 
Abhilash Nama
Guest
Posts: n/a
 
      12-03-2011
Hi,

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.

I would appreciate if someone could help me figure out why?

Thanks!

Best,
Abhilash.
 
Reply With Quote
 
 
 
 
Marvin Gülker
Guest
Posts: n/a
 
      12-03-2011
On 03.12.2011 17:31, Abhilash Nama wrote:
> Hi,


Hi,

> 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?

> I would appreciate if someone could help me figure out why?
>
> Thanks!
>
> Best,
> Abhilash.


Vale,
Marvin
 
Reply With Quote
 
 
 
 
Simon Krahnke
Guest
Posts: n/a
 
      12-05-2011
* 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginner's Beginner william nelson Ruby 7 04-11-2011 11:23 PM
What's the good book for ruby beginner and where can I find a ruby project? Guofu Chen Ruby 2 09-08-2007 01:41 PM
#!/usr/bin/ruby , #!/usr/bin/ruby -w , #!/usr/bin/ruby -T?, #!/usr/bin/ruby -T1... anne001 Ruby 1 04-23-2006 03:02 PM
No Class at ALL!!! beginner/beginner question =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?= ASP .Net 7 02-03-2005 02:47 PM
Tutorial for beginner/ Tutorial voor beginner Rensjuh C++ 7 09-02-2004 12:41 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57