# Re: newbie problem

**URL:** <https://www.ruby-forum.com/t/re-newbie-problem/194175>\
**Category:** Rails\
**Created:** [August 31, 2010, 4:56pm UTC](https://www.ruby-forum.com/t/re-newbie-problem/194175 "2010-08-31T16:56:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveamos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a698b9/32.png) [@daveamos](https://www.ruby-forum.com/u/daveamos)\
**Post date:** [August 31, 2010, 4:56pm UTC](https://www.ruby-forum.com/t/re-newbie-problem/194175/1 "2010-08-31T16:56:14Z")

</div>

On Aug 31, 3:29 am, Todd W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Shows up in browser as this:  
> [“a”, “b”, “c”]

That’s perfectly valid. [“a”, “b”, “c”] is the same as [‘a’, ‘b’,  
‘c’]. That is, “a” is the same as ‘a’, and so on. (Unlike in some  
languages, where only one or the other is used at all, or some where  
it makes a difference in the type, such as C/C++, where ‘a’ would be a  
character and “a” would be an array containing an ‘a’ and a null.)

When printing values out, Ruby represents strings using double quotes  
instead of single as you used. Ruby doesn’t remember (or care) which  
you used, once it determines the actual value of the string.

The only time it matters is when _you_ are writing a string; single  
quotes prevent variables and other “magic strings” taking on their  
values. For example, try this in irb:

> > x = 3  
> > =\> 3  
> > ‘x is #{x}’  
> > =\> “x is #{x}”  
> > “x is #{x}”  
> > =\> “x is 3”  
> > y = “foo”  
> > =\> “foo”  
> > z = ‘foo’  
> > =\> “foo”  
> > y == z  
> > =\> true

-Dave

–  
Specialization is for insects. -RAH | Have Pun, Will Babble! -me  
Programming Blog: [http://codosaur.us](http://codosaur.us) | Work: [http://davearonson.com](http://davearonson.com)  
Leadership Blog: [http://dare2xl.com](http://dare2xl.com) | Play: [http://davearonson.net](http://davearonson.net)

- 
  - 
    - 
      - 
        - WATCH THIS SPACE \* \* \* \* \* | Ruby: [http://mars.groupsite.com](http://mars.groupsite.com)

---

<div class="post-metadata">

**Author:** ![daveamos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a698b9/32.png) [@daveamos](https://www.ruby-forum.com/u/daveamos)\
**Post date:** [August 31, 2010, 7:40pm UTC](https://www.ruby-forum.com/t/re-newbie-problem/194175/2 "2010-08-31T19:40:11Z")

</div>

May be He wants to access the content of the array like this:

array[0] #1  
array[1] #2  
array[2] #3

Here’s how to access the content of the array using .each:

array = [‘a’,‘b’,‘c’]  
array.each do|x|  
puts x  
end

results  
a  
b  
c

2010/8/31 Dave A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![daveamos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a698b9/32.png) [@daveamos](https://www.ruby-forum.com/u/daveamos)\
**Post date:** [August 31, 2010, 7:45pm UTC](https://www.ruby-forum.com/t/re-newbie-problem/194175/3 "2010-08-31T19:45:28Z")

</div>

On 31 August 2010 18:38, Armand M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> array = [‘a’,‘b’,‘c’]  
> array.each do|x|  
> puts x  
> end
> 
> results  
> a  
> b  
> c

That’s not going to work in his .erb file is it, as ‘puts’ is going to  
write to the console.

If the OP actually asks a question, we’ll _know_ what he wants to do  
with his array rather than taking random stabs in the dark.
