Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding more Logical Operators
#10
(06-07-2022, 09:58 PM)Dimster Wrote: Here's an example statement with logical operators which I see as correct but it's not
IF a = 5 AND b = 6 AND c = 5 THEN c = a
PRINT c
This prints zero, when it should print -1.
Here is where I was thinking a THEREFORE function may help.

When I try the following test, I'm not getting 0 or -1: 
Code: (Select All)
Print "Test #1:"
a = 5
b = 6
c = 5
Print "  Before:"
Print "    a=" + _Trim$(Str$(a))
Print "    b=" + _Trim$(Str$(b))
Print "    c=" + _Trim$(Str$(c))
Print "  If a = 5 And b = 6 And c = 5 Then c = a"
If a = 5 And b = 6 And c = 5 Then c = a
Print "  After:"
Print "    a=" + _Trim$(Str$(a))
Print "    b=" + _Trim$(Str$(b))
Print "    c=" + _Trim$(Str$(c))

Print

Print "Test #2:"
a = 1
b = 2
c = 3
Print "  Before:"
Print "    a=" + _Trim$(Str$(a))
Print "    b=" + _Trim$(Str$(b))
Print "    c=" + _Trim$(Str$(c))
Print "  If a = 5 And b = 6 And c = 5 Then c = a"
If a = 5 And b = 6 And c = 5 Then c = a
Print "  After:"
Print "    a=" + _Trim$(Str$(a))
Print "    b=" + _Trim$(Str$(b))
Print "    c=" + _Trim$(Str$(c))

Am I missing something? Do we really need a "therefore" keyword? 

(06-07-2022, 09:58 PM)Dimster Wrote: AndAlso & OrElse sound cool. I haven't heard of them before.
Always something new under the sun.

My impression was the appraoch to QB64 has been to keep the new parts to a minimum, to accommdate newer features of PCs since the old days. 
They have been very conservative about changing the language, to keep it backwards compatible with QuickBasic. 
My concern is if we start adding fancy logical operators, it would cause compatibility issues and confuse people, and be more trouble than benefit. 

I would say that if we are going to add stuff to the language, keep it to important changes, like 
  • the ability to store an array inside a user defined type
  • better sound & graphics commands
  • a built-in GUI and form editor (like in VBA)
  • etc.

Just my opinion...
Reply


Messages In This Thread
Adding more Logical Operators - by Dimster - 05-21-2022, 08:05 PM
RE: Adding more Logical Operators - by Dimster - 06-02-2022, 12:47 PM
RE: Adding more Logical Operators - by Dimster - 06-05-2022, 01:03 AM
RE: Adding more Logical Operators - by vince - 06-06-2022, 11:14 PM
RE: Adding more Logical Operators - by Dimster - 06-07-2022, 09:58 PM
RE: Adding more Logical Operators - by madscijr - 06-13-2022, 07:19 PM
RE: Adding more Logical Operators - by madscijr - 06-13-2022, 07:01 PM
RE: Adding more Logical Operators - by madscijr - 06-14-2022, 03:52 AM
RE: Adding more Logical Operators - by madscijr - 06-14-2022, 06:59 PM
RE: Adding more Logical Operators - by madscijr - 06-14-2022, 07:58 PM



Users browsing this thread: 1 Guest(s)