3 ms·
Just include this somewhere in your codebase. Maybe I'll make this more robust. postfix operator ++{} postfix func ++(lhs:Int) -> Int { return lhs + 1 }
by coupdejarnac 10y ago
Just include this somewhere in your codebase. Maybe I'll make this more robust.
postfix operator ++{}
postfix func ++(lhs:Int) -> Int {
return lhs + 1
}
- valleyer 10y agoThat implementation is wrong in multiple ways. First of all, it should return the pre-increment value. Second, it doesn't actually increment your variable (you need to use an `inout` parameter for that). Perhaps this demonstrates perfectly why it's being removed!
- coupdejarnac 10y agoYes, indeed. I wrote this somewhat as a joke, and I hope nobody would actually do this in production.