我自學自我斯威夫特,並在return
func calculateTaxes
我得到一個錯誤。它表示Double is not convertible to()
。我的問題是()
是什麼意思?'雙'不可兌換爲()
struct Expense {
let description: String
var amount: Double = 0.0
var percentage: Double = 15.0
var taxOwed: Double
init(description: String, amount: Double) {
self.description = description
self.amount = amount
}
func string1() -> String {
return "I spent money on \(description) in the amount of $\(amount)"
}
func calculateTaxes(percentage: Double) {
var taxOwed = (self.amount*(percentage/100))
return taxOwed
}
}
()表示方法 – 2015-03-03 02:27:48
忘記指定返回類型雙 – 2015-03-03 02:29:24