06-13-2022, 07:19 PM
(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...