Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
You choose
#1
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.
Reply
#2
Since v4.0.0 the preferred way should be to use the predefined Constants.
Reply
#3
(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..
Reply
#4
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
Shoot first and shoot people who ask questions, later.
Reply
#5
Good. One vote for choice #1..
Reply
#6
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.
Reply
#7
I want paper ballots.

Pete Big Grin
Reply
#8
Chad, you're hanging again!
Reply
#9
Well, it's like the old saying goes... "I'd rather be well hung than _byte size."

Pete Big Grin
Shoot first and shoot people who ask questions, later.
Reply
#10
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.
Reply




Users browsing this thread: 1 Guest(s)