Ruby Looping with "While"


The code works, but there are still error messages. It says "Oops, try again. It looks like you didn't print out the numbers 1 to 50, inclusive."

i = 1
while i <= 50 do
    puts i
    i += 1


They want you to use the print statement ( all numbers on 1 line )
instead of you using the puts statement ( all numbers on a separate line )


yeah I ran into the same issue before codecademy is real specific about how you return and enter in code sometimes. The code is good and works fine, but for that project they want you to to return with print instead of puts, That way it doesn't create a new line for each output.


Codecademy lessons try to introduce you to Ruby via example's.....
You will still have to do some == Book == reading


To get article's on
== discussions / opinions ==
ruby [your question]


I understand that, I was just meaning that you have to watch how to enter your code and output it. Thank you for the info, but i am already familiar with many of those sites and have read a few books so far. I know that Codecademy is mainly for beginners and you have to do more than just a few examples to learn to program. I have been through lots of different training sites and tutorials and read lots of books on many different subjects. I have been teaching myself slowly for the last year starting with html and css and now onto ruby and javascript. The fact of whether or not you output using puts or print is purely a preference as to how you want the code to appear. you could also print on separate lines by including "\n". I thank you for the pointers, but honestly it seemed as though you were trying to insult me, if not than sorry for taking it that way and if so sorry as well.


A post was split to a new topic: