我从数据库中检索的浮点值,并试图将其添加到浮点类型值,我得到一个错误:in '+': Array cant be coerced into Float (TypeError)
结果 - 阵列不能强迫浮动(类型错误)
total = 0.0
db = SQLite3::Database.open "Checkout.sqlite"
for i in [email protected]
tempPrice = db.execute "SELECT price FROM Products WHERE product_code = ?", @items[i]
total = total + tempPrice
end
谢谢你的工作。 – Neeta