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
- Notes from Bing Chat—Our First Encounter With Manipulative AI - 19th November 2024
- Project: Civic Band - scraping and searching PDF meeting minutes from hundreds of municipalities - 16th November 2024
- Qwen2.5-Coder-32B is an LLM that can code well that runs on my Mac - 12th November 2024