[Gambas-user] stupid question about INC and boolean

Stefano Palmeri rospolosco at ...152...
Sat Apr 12 19:47:59 CEST 2008


Alle 19:05, sabato 12 aprile 2008, Benoit Minisini ha scritto:
> On samedi 12 avril 2008, Stefano Palmeri wrote:
> > PUBLIC SUB Main()
> >
> >   DIM iCount AS Integer
> >  
> >   FOR iCount = 0 TO 10
> >  
> >     INC $bBoolValue
> >  
> >   NEXT
> >  
> >   PRINT $bBoolValue
> >
> > END
>
> Actually I wanted that INC and DEC work on boolean values like toggles.
>
> I mean:
>
> INC $bBoolValue <=> $bBoolValue = NOT $bBoolValue
>
> Same thing for DEC $bBoolValue.
>
> Alas there is a bug in Gambas that prevents it from working correctly. I
> will fix it for the 2.6 version.
>
> Regards,

Ok. Anyway in the example TRUE is correct.
So it works good?

0 True
1 False
2 True
3 False
4 True
5 False
6 True
7 False
8 True
9 False
10 True

I don't want you to fix something that is working good :-)

I just was surprised not getting error while increasing
a boolean value. Now I know the magic behind and all
is clear.

Stefano





More information about the User mailing list