First Ruby code

January 3, 2006 at 10:07 pm Leave a comment

Ok, I cannot do much with Ruby now, so I’ve decided just to run ruby.exe and play with it for a bit. There were a couple of methods I learned from the interactive tutorial I did, and just for fun I entered this:

k = [1, 10, 5]
k.sort
k.sort.reverse
k.to_s

I have to say, this is really cool. (If you did not finish the tutorial – first line defines the array, second line presents a sorted array, third presents a sorted and reversed array, the last – an array converted to a string). As Ruby is an object-oriented language, everything is done using methods, and this is the most intuitive implementation of methods I have ever seen.

An ability to get the instant response to your line of code is also something that I missed with PHP, when I would spend several minutes to find stupid errors, when if I had an instant console, I would be able to catch them much easier.

Now I need to read up on Ruby methods and will probably take some time watching video presentations of Ruby on Rails.

Advertisements

Entry filed under: Uncategorized.

First run of InstantRails Ruby on Rails: Take-1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent posts

Starting to learn Rails?

Kindle

Get Kindle - the best e-book reader, that I personally use, and the only one that you can read on the beach - very useful: Kindle Wireless Reading Device (6" Display, Global Wireless, Latest Generation)

%d bloggers like this: