Ruby Ruby Loops Ruby Iteration For Loops

Osman Ercanli
Osman Ercanli
3,579 Points

help with forloop syntax error

for item in ["Programming", "is", "fun"] puts "Item is #{item}." end

--for the code above I am getting the below error, I can't seem to find what to correct, thank you in advance for any help--

treehouse:~/workspace$ ruby forloop.rb
forloop.rb:1: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
for item in ["Programming", "is", "fun"]
^
forloop.rb:1: syntax error, unexpected ',', expecting end-of-input
for item in ["Programming", "is", "fun"]

2 Answers

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 46,143 Points

Hey Osman,

You just need to reformat your code and it will work.

for item in ["Programming", "is", "fun"] 
  puts "Item is #{item}." 
end