Ruby: syntax error, unexpected tIDENTIFIER, expecting ')'

26,070

Not always errors are on the same lines as interpreter says ;) So it would be better if you include some adjacent lines next time. But as I found these lines are:

puts "We can also do that this way:"
puts "We'd have %d beans, %d jars, and %d crabapples." % secret_formula(start_pont

sentence = "All god\tthings come to those who weight."

words = ex25.break_words(sentence)
sorted_words = ex25.sort_words(words)

From here we see that the line before your specified line doesn't have closing parenthesis ')'.

Share:
26,070
emco
Author by

emco

Updated on December 05, 2020

Comments

  • emco
    emco over 3 years

    Working on exercise #26 of Learn Ruby The Hard Way -- correcting a ficticious programmer's bad code.

    I've got most of it worked out, but can't even get to testing because I keep getting this syntax error:

    syntax error, unexpected tIDENTIFIER, expecting ')'
    

    ...on this line:

    sentence = "All good\tthings come to those who wait."
    

    I thought that was always the way variables were declared? Since the error was listing parens, I tried those too -- around sentence (even though it made no sense), around the string (both with and without quotes), with the equals sign, without the equals sign...I'm not really sure what the issue is here.