From: jake kaiden Date: 2011-11-14T01:00:12+09:00 Subject: Re: Syntax Error hi Darren, > 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 CSV file has product_id, name, price , then type....if this helps > at all. neither `price` nor `qty' are yet defined when you try to multiply them, try something like this: require 'csv' puts "enter Product ID Number: " product_id = gets.chomp puts "Enter Qty: " qty = gets.chomp.to_f #convert string input to a float with `to_f` CSV.foreach("c:\plantproducts.csv") do |row| if product_id == row[0] price = row[2].to_f # fetch, convert from string, and store in `price variable` total = (price * qty) puts "your total is: #{total}" end end hth, - j -- Posted via http://www.ruby-forum.com/.