problem about learn-ruby-the-hard-way-Collection of common programming errors


  • Jay Bobo
    ruby learn-ruby-the-hard-way
    I’m doing Ruby the Hard Way (ex9) -> http://ruby.learncodethehardway.org/book/ex9.html Why can it not find the constant PARAGRAPH?ERROR =>:$ ruby ex9.rb ex9.rb:9: uninitialized constant PARAGRAPH (NameError)CODE (my input): # Here’s some new strange stuff, remember type it exactly.days = “Mon Tue Wed Thu Fri Sat Sun” months = “Jan\n\Feb\nMar\nApr\nMay\nJun\nJul\nAug”puts = “Here are the days: “, days puts = “Here are the months: “, monthsputs <<PARAGRAPH Theres something going on here. Wit

  • Sam
    ruby learn-ruby-the-hard-way
    I am basically halfway done with Zed Shaw’s introduction to Ruby course. However, I am stuck at a roadblock with this exercise where he gives me a piece of code and asks me to fix it. Alot of the errors were grammatical but some of the coding ones I can’t quite pick up.The errors I get are as follows:ex26.rb:76: syntax error, unexpected ‘)’, expecting ‘=’ex26.rb:99: syntax error, unexpected $end, expecting ‘)’The code:# This function will break up words for def break_words(stuff)words = stuff.

  • sawa
    ruby-on-rails ruby ruby-on-rails-4 learn-ruby-the-hard-way
    I am following Learn Ruby The Hard Way chapter 14. I typed it out myself what is on the tutorial. I even tried copying and pasting what is on the tutorial itself. My text file ex.rb has the following:user = ARGV.first prompt = ‘> ‘puts “Hi #{user}, I’m the #{$0} script.” puts “I’d like to ask you a few questions.” puts “Do you like me #{user}?” print prompt likes = STDIN.gets.chomp()puts “Where do you live #{user}?” print prompt lives = STDIN.gets.chomp()puts “What kind of computer do you hav

  • Andrew Grimm
    ruby learn-ruby-the-hard-way
    I am currently on Lesson 9 in “Learn Ruby the hard way”.I have typed the the line number 6 exactly as the way its being instructed but still I am getting error while executing.It says:Syntax error, unexpected tCONSTANT, expecting $endputs ” Here ^ are the days : “, days

  • Jauny
    ruby class learn-ruby-the-hard-way
    I understand how classes work and how to make them, but the 2nd extra credit of the exercice says to create a two-class version, in 2 different files.I tried different things, but I can’t figure out how to make it work…I don’t know if I’m not searching at the right places, but I can’t find any help on that, nor find any solution…If anyone could help me on that, it would be much appreciated :)here is the exercice : http://ruby.learncodethehardway.org/book/ex42.htmlWhat I have tried so far :ma

  • Andrew Grimm
    ruby function loops while-loop learn-ruby-the-hard-way
    I’m on Chapter 33 of Learn Ruby the Hard Way.Extra credit exercise 1 asks:Convert this while loop to a function that you can call, and replace 6in the test (i < 6) with a variable.The code:i = 0 numbers = []while i < 6puts “At the top i is #{i}”numbers.push(i)i = i + 1puts “Numbers now: #{numbers}”puts “At the bottom i is #{i}” endputs “The numbers: “for num in numbersputs num endMy attempt:i = 0 numbers = []def loops while i < 6puts “At the top i is #{i}”numbers.push(i)i = i + 1puts “N

  • Andrew Grimm
    ruby unit-testing learn-ruby-the-hard-way
    I’m working on this Exercise 49 in Learn Ruby the Hard WayThe exercise asks to write a unit test for each function provided. One of the unit tests I am writing is giving me an error.Here is the code I am testing (word_list is an array of Pair structs)Pair = Struct.new(:token, :word)def peek(word_list)beginword_list.first.tokenrescuenilend enddef match(word_list, expecting)beginword = word_list.shiftif word.token == expectingwordelsenilendrescuenilend enddef skip(word_list, token)while peek(word_

Web site is in building

I discovery a place to host code、demo、 blog and websites.
Site access is fast but not money