[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Only 1 is True, all other values are False ?



PureBytes Links

Trading Reference Links

Hello,

PLEASE RE-READ IT AGAIN:
**Numeric** value of True constant is 1 and numeric value of False constant
is 0. However in "if", "while" conditional statements ANY value different
than zero is treated as True.

That's why if you COMPARE NUMBER 1 to constant 'True' it gives you true.

BUT...
if you write:
WriteIf( 0 , "0 is True", "0 is False"); 
WriteIf( 1 , "1 is True", "1 is False"); 
WriteIf( 2  , "2 is True", "2 is False"); 
WriteIf( 3  , "3 is True", "3 is False"); 

(note NO comparison, just USING THE NUMBER in place of boolean)



Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "tintin92" <tintin922002@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, October 19, 2004 7:51 PM
Subject: Re: [amibroker] Only 1 is True, all other values are False ?


> 
> Hi,
> 
> 
>> 
>> Hello,
>> 
>> Numeric value of True constant is 1 and numeric value of False constant
>> is 0. However in "if", "while" conditional statements ANY value different
>> than zero is treated as True.
> 
> 
> Not sure about it.
> 
> I try this code :
> 
> WriteIf(0 == True , "0 is True", "0 is False"); 
> WriteIf(1 == True , "1 is True", "1 is False"); 
> WriteIf(2 == True , "2 is True", "2 is False"); 
> WriteIf(3 == True , "3 is True", "3 is False"); 
> 
> And I got this result :
> 
> Date: 26/02/2004
> 0 is False
> 1 is True
> 2 is False
> 3 is False
> 
> Tintin92
> 
> 
> 
> 
> Check AmiBroker web page at:
> http://www.amibroker.com/
> 
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/