|
|
| Author |
Message |
Don_Kirby
Joined: 15 Oct 2006
Posts: 329
Location: Long Island, New York
|
|
Posted: 06 January 2008, 0:36 AM Post subject: Boolean Handling |
|
|
I thought that this topic was discussed before here, but I haven't had any luck finding it.
How does the VM interpret true/false? I'm thinking that 255 is true, and anything else is false, although the VM most likely sets a zero when setting the variable to false. Will the VM see a byte value of 254 as false?
-Don |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR
|
|
Posted: 06 January 2008, 1:41 AM Post subject: Re: Boolean Handling |
|
|
| Don_Kirby wrote: | | How does the VM interpret true/false? | The short answer is zero/non-zero. However, True has the byte value 255 and False has the value 0 and a Boolean result (e.g. from a comparison) is always one of these values. The CBool() function will return False if and only if the value passed to it is zero. If you access a Boolean variable via an Alias or as a Based variable, zero will be interpreted as False and non-zero will be interpreted as True. |
|
| Back to top |
|
 |
Don_Kirby
Joined: 15 Oct 2006
Posts: 329
Location: Long Island, New York
|
|
Posted: 06 January 2008, 9:49 AM Post subject: Re: Boolean Handling |
|
|
| dkinzer wrote: | | If you access a Boolean variable via an Alias or as a Based variable, zero will be interpreted as False and non-zero will be interpreted as True. |
That's what I was looking for. Thanks
-Don |
|
| Back to top |
|
 |
|