Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Boolean Handling

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
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 Reply with quote

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 Reply with quote

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 Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group