Re: Ruby documentation typo



Hi --

On Wed, 31 Aug 2005, Behrang Saeedzadeh wrote:

Hi all

I just stumbled upon a typo in the Ruby documentation and thought it
would be OK to mention it here.

The typo is at the http://www.rubycentral.com/book/intro.html page:

---
Sometimes creating arrays of words can be a pain, what with all the
quotes and commas. Fortunately, there's a shortcut: %w does just what
we want.

a = %w{ ant bee cat dog elk }
---

I guess, the %w{ ant bee cat dog talk } must be %w[ ant bee cat dog
talk] as we're talking about arrays and not hashes.

Actually %w can take just about any delimiter:

  %w-a b c-
  %w!a b c!

etc.  So you can definitely use {}.


David

--
David A. Black
dblack@xxxxxxxxxxxx


.



Relevant Pages

  • Re: Array in javascript
    ... God damn it was an after-midnight typo, ... it will error-out just as quickly with any value type ... in the inner arrays. ... components are logically incapable of exhibiting that quality at all. ...
    (comp.lang.javascript)
  • Re: Deleting garbage
    ... Also:Search accepts arrays.. ... keepITcool ... Donna Yawanna wrote: ... >> bb's to an aa - think that was just a typo. ...
    (microsoft.public.excel.programming)
  • Re: The next number that is not in an array
    ... On Thu, Jul 17, 2008 at 9:05 PM, Michael W. Ryder ... I think there is a typo in here;) ... e.g. very densely populated rn arrays ...
    (comp.lang.ruby)
  • Re: Newbie help needed with Applet
    ... I strongly suggest you get comfortable with arrays then, ... typo could really cost you a lot of debugging time. ...
    (comp.lang.java.programmer)
  • Ruby documentation typo
    ... I just stumbled upon a typo in the Ruby documentation and thought it ... Sometimes creating arrays of words can be a pain, ... Prev by Date: ...
    (comp.lang.ruby)