Reputation: 2328
This is my program:
my_hash.each |w| do
p "is this right?"
awesome_print w
fix = gets
fix.chop
if (fix == "N")
p "Tell me what it should be"
correction = gets
w[1] = correction
end
end
This is the error I get:
what.rb:1: syntax error, unexpected keyword_do_block
what.rb:12: syntax error, unexpected keyword_end, expecting $end
does anybody know why I get that error?
here's my_hash:
{:banana=>:fruit, :pear=>:fruit, :sandal=>:fruit, :panda=>:fruit, :apple=>:fruit}
I just want to operate on each individual key pair in the conventional Ruby way. How do I do that?
Upvotes: 1
Views: 608
Reputation: 35803
You have the syntax backward. It should be:
my_hash.each do |w|
Instead of:
my_hash.each |w| do
Upvotes: 4