# Re: nuby: %w to understand quotes

**URL:** <https://www.ruby-forum.com/t/re-nuby-w-to-understand-quotes/58614>\
**Category:** Ruby\
**Created:** [April 24, 2006, 2:32am UTC](https://www.ruby-forum.com/t/re-nuby-w-to-understand-quotes/58614 "2006-04-24T02:32:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [April 24, 2006, 2:32am UTC](https://www.ruby-forum.com/t/re-nuby-w-to-understand-quotes/58614/1 "2006-04-24T02:32:06Z")

</div>

Justin C. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] :

# In that case, wouldn’t it be easier to just do

# 

# [“sample”, “short sample”, "there is quite a number of strings longer

# than this"]

that’s what i’m doing now (instead of escaping). But as much as  
possible, I would like to quote only when needed.

Right now,

irb(main):004:0\* %w{test this is a test}  
=\> [“test”, “this”, “is”, “a”, “test”]  
irb(main):005:0\> %w{test “this is” “a test”}  
=\> [“test”, “"this”, “is"”, “"a”, “test"”]  
irb(main):006:0\>

The quotes have no use. Maybe ruby 1.9 can make use of them.

kind regards -botp

---

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [April 24, 2006, 2:53am UTC](https://www.ruby-forum.com/t/re-nuby-w-to-understand-quotes/58614/2 "2006-04-24T02:53:32Z")

</div>

On Sunday 23 April 2006 08:30 pm, Botp wrote:

> Justin C. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] :
> 
> # In that case, wouldn’t it be easier to just do
> 
> # 
> 
> # [“sample”, “short sample”, "there is quite a number of strings longer
> 
> # than this"]
> 
> that’s what i’m doing now (instead of escaping). But as much as possible, I  
> would like to quote only when needed.

But why? %w is intended as a shortcut when everthing is a single word.  
For  
anything else, use quotes.
