![]() |
You choose - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +---- Forum: GitHub Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=42) +---- Thread: You choose (/showthread.php?tid=3593) |
RE: You choose - PhilOfPerth - 04-08-2025 (04-08-2025, 04:14 AM)SMcNeill Wrote: Looking at the original post, I'd have to say: Pardon? ![]() As someone famouser than me once said, "what is truth?" (no, I don't think it was Trump). RE: You choose - Ikerkaz - 04-08-2025 I prefer number 1. BTW, I didn't know that _TRUE and _FALSE are in QB64 now... I will use them from now ![]() RE: You choose - bplus - 04-08-2025 I prefer 0 and -1, less typing. RE: You choose - eoredson - 04-09-2025 Amazing boolean comparisons. Now try this: Code: (Select All) Const false = 0 RE: You choose - Pete - 04-09-2025 Needs to be written as: z = true = Not true That gives z the expected value of zero. The IDE does not pick up the error with z = true Not true but the compiler does. Pete RE: You choose - madscijr - 04-09-2025 At this point, I just use _TRUE and _FALSE which eliminates 2 lines of code and any guesswork. But if we have to define it, I would opt for explicit (#1) Const False=0 : Const True=-1 because with Const TRUE = Not FALSE a couple of times I needed to know the value, and I couldn't recall if it was -1 or +1, and had to resort to doing a PRINT str$(TRUE) to be reminded, which was annoying. Really, I am totally happy with _TRUE and _FALSE being natively supported now, so we don't have to think about this stuff! RE: You choose - bplus - 04-09-2025 Is there any advantage of using a Constant over a hard number in this case? Because I can think of tons where an IF would evaluate to true enough without being = to -1 Code: (Select All) x = 1 RE: You choose - madscijr - 04-09-2025 Yes, the advantage is READABILITY! ![]() RE: You choose - bplus - 04-09-2025 Really we have to spell it out for you? 0 = False Besides True = -1 does not cover all things Not False and I am sure we don't want to see the list of all things Not False ![]() Perhaps False$ = "" ? RE: You choose - madscijr - 04-09-2025 (04-09-2025, 06:56 PM)bplus Wrote: Really we have to spell it out for you? 0 = FalseMaking False a string seems like an unnecessary complication. Is this a debate of preferences or is the QB64PE team looking to do away with _TRUE / _FALSE ? Since under the hood, _TRUE and _FALSE are integers -1 and 0, why not just add a simple option to the IDE, a checkbox "Display _TRUE / _FALSE as numbers" and when it's checked, it automatically replaces all _TRUE / _FALSE with -1 & 0 ? The only problem is that it's irreversible - unchecking it, it won't know which -1s & 0s to replace again with _TRUE/_FALSE, LoL. Or perhapse under the hood it stores anything that was entered as _TRUE / _FALSE as a special token, so that it can change back & forth? Really, I prefer the IDE to let you configure your options so that you can view the code according to your preferences, rather than be forced to endure someone else's. It's like how in C & JavaScript some people prefer the "Egyptian" style of putting the opening curly brace at the end of the previous line and others want it on its own line. I know some people like code to be as stripped down as possible (like C syntax) and others like it more verbose (like Python) but it's 2025, shouldn't we be able to choose our own syntax where our tools "render" the code to our liking on the fly? I realize this is a longer reply than you probably expected or wanted but this kind of discussion opens that debate! ![]() |