Pergunta

I understand that the title was very vague and my apologies. I am using Lynda.com to learn Ruby and am using 1.9.2 on Ubuntu 11.10.

Anyway. While following this tutorial I have purchased the example files for reference.

Following the Arrays section of this tutorial it tells me to type in stuff, and I'm to expect the same answer he gets. However.....

I don't.

If you look at the screenshot they are not the same. Video is on the left, terminal is on the top right, the example file is on the bottom right. I am not getting the expected results. I have checked in the terminal settings and I don't see anything that I'm missing. Please advise.

Also, I cannot post images because I am below 10 posts. Please copy and paste the link.

http://i.imgur.com/WP8MR.png

Foi útil?

Solução

enter image description hereThere is a typo in the irb where you are testing the code. It should have been:

irb> data_set = []
irb> data_set = ["a","b","c"]

but you have mistyped it as data_set['a","b","c"] thats why its messing up. Notice that you have enclosed a in wrong set of quotes. See my image (ruby 1.9.2, Win 7)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top