I retrieved a Float value from my database and tried to add it to a Float type value and I get an error: in '+': Array cant be coerced into Float (TypeError)
total = 0.0
db = SQLite3::Database.open "Checkout.sqlite"
for i in 0..@items.length
tempPrice = db.execute "SELECT price FROM Products WHERE product_code = ?", @items[i]
total = total + tempPrice
end
1 Answer