The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Overriding operators: two dimensional arrays

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Matt Williams

Posts: 466
Nickname: aetherical
Registered: Feb, 2008

Matt Williams is a jack-of-all trades living in Columbus, OH.
Overriding operators: two dimensional arrays Posted: Feb 23, 2009 2:54 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Matt Williams.
Original Post: Overriding operators: two dimensional arrays
Feed Title: Ruby Blender
Feed URL: http://feeds2.feedburner.com/RubyBlender
Feed Description: This blog contains short-ish ruby tips, hints, and techniques.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Matt Williams
Latest Posts From Ruby Blender

Advertisement
Image via Wikipedia

One of the neat things about ruby is that, in general, operators are methods, so they can be overridden. When working with multidimensional arrays, some languages allow you to do the following: Text |  copy code |?1a[0,0]
whereas ruby uses: Ruby |  copy code |?1a[0][0]
Which makes sense, since Ruby implements it as an array of arrays and you’re chaining methods to [...]

Read: Overriding operators: two dimensional arrays

Topic: A life lesson Previous Topic   Next Topic Topic: What one book do you recommend, and why?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use