QB64 Phoenix Edition
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)

Pages: 1 2 3


You choose - eoredson - 04-08-2025

Which do you prefer:

Code: (Select All)
Const False=0
Const True=-1
or

Code: (Select All)
Const False=0
Const True=Not False
or

Code: (Select All)
Const True=-1
Const False=Not True
I am taking a poll..

Erik.


RE: You choose - RhoSigma - 04-08-2025

Since v4.0.0 the preferred way should be to use the predefined Constants.


RE: You choose - eoredson - 04-08-2025

(04-08-2025, 01:15 AM)RhoSigma Wrote: Since v4.0.0 the preferred way should be to use the predefined Constants.
That wasn't one of the choices! But a vote for _False and _True is taken into consideration..


RE: You choose - Pete - 04-08-2025

I'm sure Steve would put me at....

CONSTANT Pete = PITA

Other than that, I'm good with the first one, although I'd write it with True as the top statement.

For fun, I've been using Not with _bit variables. The downside is debugging. It's flipping hard to tell, using that method, which value you're tracking, -1 or 0.

Pete Big Grin


RE: You choose - eoredson - 04-08-2025

Good. One vote for choice #1..


RE: You choose - eoredson - 04-08-2025

The polls have closed at 04/07/2025:

The result of all 2 people who have voted the results are:

  1 vote for choice #1 and
  a vote for none of the above.

Thank you for taking the time to vote for this very important topic..

Erik the votemaster.


RE: You choose - Pete - 04-08-2025

I want paper ballots.

Pete Big Grin


RE: You choose - SMcNeill - 04-08-2025

Chad, you're hanging again!


RE: You choose - Pete - 04-08-2025

Well, it's like the old saying goes... "I'd rather be well hung than _byte size."

Pete Big Grin


RE: You choose - SMcNeill - 04-08-2025

Looking at the original post, I'd have to say:

1) I'm with Rho.  Just use _True and _False.  They're built in the language now.

2) If one has to define a value themselves, then I prefer either of the first two methods.  In basic True is always NOT FALSE, but FALSE isn't always NOT TRUE.

FALSE is *only* NOT TRUE when True is -1, but BASIC considers any non-zero value to be True.

2 is True.  NOT 2 is.. -3.  Which is also True.

0 is False.  That's the only guarantee BASIC makes.  Saying True = NOT FALSE will always be correct.  Thinking FALSE = NOT TRUE is only correct in the limited scope of *IF TRUE = -1*.  When dealing with CONST, there's nothing wrong with writing it as your third example does, with the exception that it reinforces the concept that False = Not True, which isn't a true statement all the time.

If one is going that route, then they could probably just use FALSE = _NEGATE True.  Then that statement would always be valid and correct.

2 = True.  _NEGATE 2 = 0.  Which is, indeed, False.

A subtle difference, but one that I think if someone learned to adapt to, it might save them some issues later down the road.  NOT TRUE can still sometimes be TRUE, but _NEGATE TRUE will always be FALSE.