I have several boolean variables, which I would like to summarize to an int variable in an easier way than the example below, after all there are dozens of variables.
For example:
Being that it would be the equivalent of all the possible possibilities, as in the following table.
varSingle
Var1
Var2
Var3
0
0
0
0
1
0
0
1
2
0
1
0
3
1
0
0
4
0
1
1
5
1
1
0
6
1
0
1
7
1
1
1
Thank you in advance for your help!
My suggestion would be to use multiple case statements, but because of repeating values (4, 5, 6, 7) a single switch would not work, but you can split them to handle each condition:
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I found the solution I needed.
See below.
Thanks for the help guys!
Your ideas helped me reach the conclusion!
Good night.
I have the following demand, where I need help.
I have several boolean variables, which I would like to summarize to an int variable in an easier way than the example below, after all there are dozens of variables.
For example:
Being that it would be the equivalent of all the possible possibilities, as in the following table.
Thank you in advance for your help!
My suggestion would be to use multiple case statements, but because of repeating values (4, 5, 6, 7) a single switch would not work, but you can split them to handle each condition:
Here is an example, untested.
But as a starting point, this might be a solution to your problem.
How to use:
At least thats how it sould work, as said its untested.