Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

If foxes can learn Ruby, why can’t you?

Why The Lucky Stiff’s (poignant) guide to Ruby is shaping up to be a masterpiece. Trust me, you’ve never read a programming language guide that’s even remotely comparable. Even if you have no interest in Ruby you should check it out, if only for the cartoon foxes. Here’s Why’s explanation of Ruby’s array syntax:

An array is a list surrounded by square brackets and separated by commas.

[1, 2, 3] is an array of numbers.

['coat', 'mittens', 'snowboard'] is an array of strings.

Think of it as a caterpillar which has been stapled into your code. The two square brackets are staples which keep the caterpillar from moving, so you can keep track of which end is the head and which is the tail. The commas are the caterpillar’s legs, wiggling between each section of its body.

Once there was a caterpillar who had commas for legs. Which meant he had to allow a literary pause after each step. The other caterpillars really respected him for it and he came to have quite a commanding presence. Oh, and talk about a philanthropist! He was notorious for giving fresh leaves to those less-fortunate.

The foxes say it best:

This is If foxes can learn Ruby, why can’t you? by Simon Willison, posted on 20th February 2004.

View blog reactions

Next: Recommendations for a cheap US dial-up provider?

Previous: Catching up with Harry

6 comments

  1. I'm thinking more programming books should be like that :-)

    Simon Mackie - 20th February 2004 04:45 - #

  2. Noticed this the other day, and sent it to everyone I know. I've not laughed so much in ages!

    Andrew - 20th February 2004 09:09 - #

  3. At last a serious book about programming!

    Now, let's eat some chunky bacon ^_^

    Mathieu 'P01' HENRI - 20th February 2004 13:34 - #

  4. Hilarious! Thanks for the tip!

    Mike P. - 22nd February 2004 19:21 - #

  5. discovered why's book today. i'm stunned. this is not just funny. it's brilliant.

    ms - 30th December 2005 01:42 - #

  6. I have only just subscribed, and I haven't read the book yet. I have high expectations of humour and learning ease though - does that count?

    Ian Turner - 16th August 2006 10:47 - #

Comments are closed.

Previously hosted at http://simon.incutio.com/archive/2004/02/20/foxes

A django site