Re: [Gambas-user] Referencing an array element with boolean

2014-06-21 Thread Patrik Karlsson
2014-06-21 12:28 GMT+02:00 Tobias Boege : > On Sat, 21 Jun 2014, Patrik Karlsson wrote: > > 1. Why is Abs(True) True? > > Because the mapping Integer -> Boolean is not injective. The rule is: 0 > maps > to False, everything else maps to True. To be able to map Boolean -> > Integer > the convention

Re: [Gambas-user] Referencing an array element with boolean

2014-06-21 Thread Patrik Karlsson
2014-06-21 12:23 GMT+02:00 Benoît Minisini : > Le 21/06/2014 09:47, Patrik Karlsson a écrit : > > 3. I have a "BoolToIndex" function in a library module but I was thinking > > if it should not be part of the language, to be able to reference in > > a _simple_ way to an array element with a boolean

Re: [Gambas-user] Referencing an array element with boolean

2014-06-21 Thread Tobias Boege
On Sat, 21 Jun 2014, Patrik Karlsson wrote: > Many years ago when I was programming in Delphi I used to have object > arrays of size 2 and referencing to the element index with true and false. > This was very very useful. > > It was possible since false=0 and true=+1. > In Gambas we have false=0 a

Re: [Gambas-user] Referencing an array element with boolean

2014-06-21 Thread Benoît Minisini
Le 21/06/2014 09:47, Patrik Karlsson a écrit : > Many years ago when I was programming in Delphi I used to have object > arrays of size 2 and referencing to the element index with true and false. > This was very very useful. > > It was possible since false=0 and true=+1. > In Gambas we have false=0

[Gambas-user] Referencing an array element with boolean

2014-06-21 Thread Patrik Karlsson
Many years ago when I was programming in Delphi I used to have object arrays of size 2 and referencing to the element index with true and false. This was very very useful. It was possible since false=0 and true=+1. In Gambas we have false=0 and true=-1. So now I came up with: Dim sMoods As Stri