If foxes can learn Ruby, why can’t you?
20th February 2004
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:
More recent articles
- Qwen2.5-Coder-32B is an LLM that can code well that runs on my Mac - 12th November 2024
- Visualizing local election results with Datasette, Observable and MapLibre GL - 9th November 2024
- Project: VERDAD - tracking misinformation in radio broadcasts using Gemini 1.5 - 7th November 2024