Right tool for the job let's me move on but doesn't put!


#1



https://www.codecademy.com/en/courses/ruby-beginner-en-1o8Mb/2/1?curriculum_id=5059f8619189a5000201fbcb#


I keep getting this error message, now this example is for line 1 but it was also for line 2 in the past.

(ruby):1: syntax error, unexpected '}', expecting keyword_end

The exercise says I passed but in the end because of the error there's nothing that got puts on the screen :frowning:
I'd like to get to the end of this ^^.
Thanks for your help and feedback.


my_array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
my_array.each { if my_array.even? then puts my_array}


#2

That's not a valid if-expression (have a look at a reference for the syntax, though the error message already says what the problem with the if-expression is)


#3

Hi, sorry for my late reply. Alright thanks a lot for your help in solving this ! Much appreciated !


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.