A Quick Cautionary Tale

Just a quick word of warning, when you want to write

array = [ 1, 2, 3, 4 ]

don’t write

array = { 1, 2, 3, 4 }

the latter in fact being equivalent to writing

array = { 1 => 2, 3 => 4 }

and will keep you up till 3am trying to understand why your code is broken.


Farrel Lifson is a lead developer at Aimred.

About Aimred

Aimred is a specialist Ruby and Ruby on Rails development house and consultancy based in Cape Town, South Africa.

We provide Ruby and Ruby on Rails development, consulting and training services to all enterprise levels. If you want to find out how we can help your company, contact us at info@aimred.com.

Recent Posts