Announcement

Collapse
No announcement yet.

Boolean Data Type

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Boolean Data Type

    I did not see a Boolean data type in the manual. Does PB/DLL 6 support such a beast?

  • #2
    Just use a Long data type
    Code:
    VB Code:
    Dim Bool1 as boolean
    Dim Bool2 as boolean
    Dim Bool3 as boolean
    
    Bool1 = CBool(x1 > x2)
    Bool2 = CBool(x3 < x4)
    Bool3 = Bool1 AND Bool2
    If Bool3 Then
    ...
    PB equivalent
    
    Dim nBool1 as Long
    Dim nBool2 as Long
    Dim nBool3 as Long
    
    nBool1 = (x1 > x2)
    nBool2 = (x3 < x4)
    nBool3 = nBool1 and nBool2
    If nBool3 then 
    ...
    Hope this helps

    Joe Murphy

    ------------------

    Comment


    • #3
      Just a side note in case your wondering why you have to use a LONG and waist 31 bits on a %True/%False value: Our modern 32bit processors can process the LONG (or DWORD) much faster than they can a single bit BOOL. Thus this also applies to all other data types. If you want to have it as fast as possible, use a 32bit data type. For example, as opposed to the old DOS days, using and integer for counting is not faster than using a long. The other data types still exists for the cases where size is the priority as opposed to computation.

      Coin Schmidt

      ------------------
      Colin Schmidt & James Duffy, Praxis Enterprises, Canada

      Comment

      Working...
      X