boolean question 
Author Message
 boolean question

hi,
have:  
mybool :  boolean;
then in begin how can i say?:
mybool := mybool OR Notmybool;
then pass it to my function:
myfunc(some,mybool,anotherbool);

i like mybool to be true or not to be true.

--
Sent by 1  from yahoo subpart from  com
This is a spam protected message. Please answer with reference header.
Posted via http://www.*-*-*.com/



Thu, 02 Dec 2004 00:56:12 GMT  
 boolean question



Quote:
> hi,
> have:
> mybool :  boolean;
> then in begin how can i say?:
> mybool := mybool OR Notmybool;
> then pass it to my function:
> myfunc(some,mybool,anotherbool);

> i like mybool to be true or not to be true.

This doesn't seem to make sense?

Being a boolean variable mybool has two
possible values: true and false, so your
expressed intention is fulfilled already by
the declaration of mybool.

The assignment mybool := x or y
is true if either x or y or both are true so
if your statement is
mybool := mybool or (not mybool) you
could as well just code mybool := true

What do you really want?

regards Sven



Thu, 02 Dec 2004 14:58:52 GMT  
 boolean question

Quote:

> hi,
> have:
> mybool :  boolean;
> then in begin how can i say?:
> mybool := mybool OR Notmybool;
> then pass it to my function:
> myfunc(some,mybool,anotherbool);

> i like mybool to be true or not to be true.

If you wish to have the value of mybool switching back and forth between
True and False, then the solution is quite easy:

    mybool := (mybool = False) ; {Note that the second equal sign has no
colon preceeding it.}

If you wish to have the value set at random, then you will need to create
a random number and test if the value of this number is Odd or Even.  (See
function Odd in Help File.)  The value of mybool can then be set
accordingly.

Quote:

> --
> Sent by 1  from yahoo subpart from  com
> This is a spam protected message. Please answer with reference header.
> Posted via http://www.usenet-replayer.com/cgi/content/new

--
Val Mehling

XRL (Extreme Racing League) Info
http://extremeracingleague.com/

http://home.earthlink.net/~valjm/
http://odin.prohosting.com/valmeh/



Thu, 02 Dec 2004 23:05:14 GMT  
 boolean question
hi


Quote:

> > hi,
> > have:
> > mybool :  boolean;
> > then in begin how can i say?:
> > mybool := mybool OR Notmybool;
> > then pass it to my function:
> > myfunc(some,mybool,anotherbool);

> > i like mybool to be true or not to be true.

> If you wish to have the value of mybool switching back and forth between
> True and False, then the solution is quite easy:

>     mybool := (mybool = False) ; {Note that the second equal sign has no
> colon preceeding it.}

mybool :=  not mybool; { might work too, ;-) }

[...]

regards
jochen



Fri, 03 Dec 2004 05:42:32 GMT  
 boolean question
|

|> If you wish to have the value of mybool switching back and forth =
|between
|> True and False, then the solution is quite easy:
|>
|>     mybool := (mybool = False) ; {Note that the second equal sign =has no
|>                                                            colon preceeding it.}
|
|mybool :=  not mybool; { might work too, ;-) }

The later is better code.  

It is (IMHO) poor practice to compare a boolean to true or false.
Better to use

   if MyBool then....

or

  if not MyBool then...

I think it also generates more efficent code.

Phil



Fri, 03 Dec 2004 06:25:25 GMT  
 boolean question
Var DoCheck : boolean;

begin
   DoCheck := false;
   while not DoCheck do
     begin
         //do stuff
     end;
end.



Quote:
> hi,
> have:
> mybool :  boolean;
> then in begin how can i say?:
> mybool := mybool OR Notmybool;
> then pass it to my function:
> myfunc(some,mybool,anotherbool);

> i like mybool to be true or not to be true.

> --
> Sent by 1  from yahoo subpart from  com
> This is a spam protected message. Please answer with reference header.
> Posted via http://www.usenet-replayer.com/cgi/content/new



Sat, 04 Dec 2004 11:28:46 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. boolean & succ question

2. Boolean in SQL with Paradox DB

3. Boolean RANGE

4. Q: Does Interbase have a boolean variable?

5. MSAccess97 boolean fields being returned as smallints??

6. Interbase, Boolean types, and dbCheckBox

7. SQL-Typecasting to boolean ?

8. Boolean Variables

9. Boolean

10. Help, I'm Stuck in Boolean Reality

11. Boolean

12. displaying boolean fields in DBGrid

 

 
Powered by phpBB® Forum Software