08-04-2009 06:35 PM
Hello
I have three booleans in my code and the combination of their values (true or false) control another part of the code. Since there are three booleans and they can be true or false, I have 8 possible combinations (2^3). What should I do to, considering the values of the three booleans, have a numeric indicator that show which combination I have? The range of the numeric indicator will be 1 to 8.
Thanks in advance
Daniel
Solved! Go to Solution.
08-04-2009 06:44 PM
Create an array and then use the Boolean Array to Number.
08-04-2009 06:55 PM - edited 08-04-2009 06:55 PM
08-04-2009 07:11 PM
I have one more question. I would like to convert these 8 combinations to 0 and 1 combinations. Considering 0 as false and 1 as true, we will have 8 combinations like this:
000
111
110
011
010
100
001
101
What code should I use to generate, for example, a array with these sequences? One sequence as each element of a string array, for example.
Thanks.
08-04-2009 07:28 PM - edited 08-04-2009 07:29 PM
08-04-2009 07:44 PM
Exactly!
Thanks!