[quote=204516:@Dave S]
return IF(b,1,0)[/quote]
Yeah, that works if you’re using a recent Xojo version, which I don’t
I really hate it that it’s not been named “iff” as it’s been done in other languages. That would have even made it possible to keep it backward compatible. Sigh.
Using IIf would have broken code that already had a function named IIf, which is a nontrivial number of projects. ‘If’ is already a keyword, so using it for inline if expressions didn’t break any code.
I wrote “iff”, though. I F F. Though, while it is indeed used in tech speak (https://en.wikipedia.org/wiki/If_and_only_if), it’s not necessarily the best match for what I was asking here. But I am pretty sure other languages are using iff() the way I suggest.
Not to mention explicit. i.Inc doesn’t tell me anything about what it does. I like may names to means something at a glance and this fails that reasoning.
A better name would IncrementByOne which is a lot more typing. Thankfully AutoComplete would make this a non-issue. But then I’m thinking it’s too long so I’d go back to the i = i + 1. Short, sweet, and explicit.
I really don’t want to make Xojo more like c unless I absolutely have to.
I’ll mention again that I wrote a series of Keyboard Maestro macros that will let me type ‘statement (opt)+(opt)+’ that will substitute ‘statement = statement + 1’, if anyone wants them.
(Why opt-plus? I found I was accidentally using ++ in other areas that were triggering the macro. Same for minus-minus.)
Three weeks after we moved into our new flat I met our 94 year old neighbour on the stairs and she said in kind of a surprised voice: “you have SUCH a beautiful wife!”. I grinned at her and answered: “ and she has SUCH a handsome husband ” and you could see honesty and politeness fighting each other on her face before she squealed: she has a very nice husband." and we just grinned at each other.