Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why "while done = 0" but not "while not done&
#11
That's why FB needs boolean operators in addition to the bitwise ones... V1c?
Reply
#12
Quote:That's why FB needs boolean operators in addition to the bitwise ones... V1c?
It's in the todo list, "AndThen" and "OrElse".

For now, this works for boolean and:
Code:
IF a THEN IF b THEN
   ...
END IF
Not correct QB syntax, but it works in FB.
Reply
#13
yay! the joy of lazy expresion evaluation! Smile

a% ANDTHEN b% will only check b% if a% is true... that is very useful. One of the C and php thingos that i love more:

Code:
$i = initLib () Or Die("Bad!");

(php example) That's lazy expresion evaluation: if InitLib () returns TRUE, as the expression is an OR it will be true, so no need to keep evaluating, so Die("Bad!") won't be executed. If InitLib() returns FALSE, you have to keep evaluating.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#14
No, AndThen and OrElse are just short-circuit bitwise ops, not boolean... unless I'm missing something...
Reply
#15
Oh yeah, I guess they could be bitwise.
Reply
#16
Quote:No, AndThen and OrElse are just short-circuit bitwise ops, not boolean... unless I'm missing something...

That has nothing to do with what I pointed out about lazy expresion evaluation, replying to Sterling example which is a clear example of it.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#17
Quote:It's in the todo list, "AndThen" and "OrElse".
I propose AndAlso instead of AndThen.

Quote:Not even in C you can grant that false = 0 and true = 1, 'cause that could not be true in some implementations/platforms.
From the C++ standard:

§4.5.4
Quote:An rvalue of type bool can be converted to an rvalue of type int, with false becoming zero and true becoming one.

§4.7.4
Quote:If the source type is bool, the value false is converted to zero and the value true is converted to one.
Reply
#18
Read: C.

Not C++ Wink
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)