Easy-Cal-Swift重载Swift的+-*/操作符,使其更容易使用。
类型安全但却浪费时间:
var a = 3var b = 2.0a + b //Compile errora - b //Oops, error againa * b //Wtf..a / b //God please save me//You have to write these insteadDouble(a) + bDouble(a) - bDouble(a) * bDouble(a) / b使用示例:
var a = 3var b = 2.0a + b //5.0a - b //1.0a * b //6.0a / b //1.5
评论