我從數據庫中檢索的浮點值,並試圖將其添加到浮點類型值,我得到一個錯誤: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