我从数据库中检索了一个 Float 值并尝试将其添加到 Float 类型值中,但出现错误: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