From: Stefano Crocco Date: 2011-11-13T07:05:33+09:00 Subject: Re: Syntax Error On Sunday 13 November 2011 06:51:16 Darren H. wrote: > Hi All, > > I am somewhat new to Ruby coding and programming altogether, > > > > puts "enter Product ID Number" > product_id = gets.chomp > CSV.foreach("c:\plantproducts.csv") do |row| > if product_id == row[0] > do (price * qty) > end > end > > puts "Enter Qty) > qty = gets.chomp > > > # the price is given in the csv file when I run the code I get an error > "syntax error, unexpected keyword_do_block do (qty * price) > > > Can someone give me some advice so that shit code runs? > > # The CSV file has product_id, name, price , then type....if this helps > at all. > > thanks The do keyword in the line after the if is wrong. Remove it and everything should work, at least after you also add the missing quote at the end of the line before the last. I hope this helps Stefano