我在arduino ide中添加了这段代码(bluetooth.print(“4”);),它会在手机中打印出来吗?但是数据是44444444444,那么如何获得像4这样的数据不能重复?
答案 0 :(得分:0)
enum Key: String {
case id = "id", amount = "amount", createdAt = "createdAt", status = "status"
}
class Payment {
let id: Int
let amount: Int
let createdAt: Int
let status: String
func compare(toOther other: Payment, byKey key: Key, ascending: Bool) -> Bool {
switch key {
case .id:
return ascending ? self.id < other.id : self.id > other.id
case .amount:
return ascending ? self.amount < other.amount : self.amount > other.amount
case .createdAt:
return ascending ? self.createdAt < other.createdAt : self.createdAt > other.createdAt
case .status:
return ascending ? self.status < other.status : self.status > other.status
}
}
}
那只打印4次。但这可能不是你想要的答案。您必须提供更多细节才能获得真正有用的东西。