Author Topic: IF statement  (Read 6817 times)

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: IF statement
« Reply #15 on: December 30, 2020, 08:28:47 pm »
Fell, you almost stole my trademark line...

Just because you can, doesn't mean you should.(tm)

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: IF statement
« Reply #16 on: December 31, 2020, 01:07:43 am »
In the spirit of QB64's essence, I don't even think it should.

Agreed.
Granted after becoming radioactive I only have a half-life!

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
Re: IF statement
« Reply #17 on: December 31, 2020, 10:35:19 am »
Would EXIT IF not be a form of short circuiting? Or does Short Circuiting apply solely to a situation of multiple logical conditions?

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: IF statement
« Reply #18 on: December 31, 2020, 11:04:17 am »
Would EXIT IF not be a form of short circuiting? Or does Short Circuiting apply solely to a situation of multiple logical conditions?

that bugs out of the entire IF\THEN block spaghetti style .

What he wants here is to have a situation where meeting one criteria of an IF question ,opens the door so to speak, so any other criteria are ignored.
Granted after becoming radioactive I only have a half-life!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: IF statement
« Reply #19 on: December 31, 2020, 12:59:23 pm »
that bugs out of the entire IF\THEN block spaghetti style .

What he wants here is to have a situation where meeting one criteria of an IF question ,opens the door so to speak, so any other criteria are ignored.

Yeah in a series of AND conditions one False Boolean Test (=0) would knock the code execution off the THEN clause and start looking for an ELSE if any (before END IF), it is built in and must require some sort of look ahead in built-in code to know that OR wasn't in that series of ANDs of code line, OR hitting one FALSE it jumps ahead and looks for an OR part to begin evaluating for TRUE.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: IF statement
« Reply #20 on: January 01, 2021, 06:44:10 am »
I agree with Bplus
Quote
Yeah in a series of AND conditions one False Boolean Test (=0) would knock the code execution off the THEN clause and start looking for an ELSE if any (before END IF), it is built in and must require some sort of look ahead in built-in code to know that OR wasn't in that series of ANDs of code line, OR hitting one FALSE it jumps ahead and looks for an OR part to begin evaluating for TRUE.

because a multi presence of AND could lead to the cortocircuit of the evaluation statement, but we need just one OR  or XOR to make a mistake activating the cortocircuit procedure.
So the parser must evaluate BEFORE the OR/XOR options and then from the first to the last AND options....remembering that for OR you can have one or two condition true to get true while for XOR you must have only a condition true to get true
as you can see herehttp://qb64.org/wiki/Bitwise_Operators
Programming isn't difficult, only it's  consuming time and coffee