Hello freinds,
We say that:
Boolean constants may have the value of true or false, numeric representation of them is 1 or 0, respectively. True or TRUE, False or FALSE can be used, as well.
Examples:
Its internal representation is a long 4-byte integer number. Boolean constants can assume the values of 0 or 1.
I have a problem, and I nnd your help:
The code lines are:
...
bool alfa[19];
int beta[50][300];
int gamma[50];
...
alfa[1] = 1;
...
beta[0][11] = alfa[9] * gamma[9] + !alfa[9] * StrToTime("00:00");
My quations are:
Do I right if I say: a bool variable is 0 if it is FALSE, and a bool variable is 1 if it is TRUE?
and:
Why do I get an error massage on the last code line - "=" - assignment expected ?
Please help.
Thanks,
Question 1: right.
What exactly do you try to achieve with that line of code? You mix up different data types.
Hello freinds,
We say that:
Boolean constants may have the value of true or false, numeric representation of them is 1 or 0, respectively. True or TRUE, False or FALSE can be used, as well.
I don't say that . . .
Think of a bool as True or False . . . forget 0 and 1 . . . where is the logic of trying to do bool * int ? what goes true * 5 mean ? very true ?
I don't say that . . .
Think of a bool as True or False . . . forget 0 and 1 . . . where is the logic of trying to do bool * int ? what goes true * 5 mean ? very true ?
Thanks Raptor,
Exactly. I agree with you.
My decompiler returned it so. Is there any possibilty to understand it....? I need your help!!
Thanks Raptor,
Exactly. I agree with you.
My decompiler returned it so. Is there any possibilty to understand it....? I need your help!!
Any one can help?
Any one can help?
I don't think there is a possibility to understand why different datatypes should be added/multiplicated together. And I am not sure about you should ask questions for decompiled code. However, put !alfa[9] in brackets - (!alfa[9]) - and you have a chance it does compile.
edit: Of course you can e.g. multiplicate a double with an integer and assign it to a double.
Thanks Raptor,
Exactly. I agree with you.
My decompiler returned it so. Is there any possibilty to understand it....? I need your help!!
Explicit | Compact |
---|---|
if (isSomething) double x = A; else x = B; | double x = isSomething * A + !isSomething * B;
|
double x = A; if (isSomething) x += B; | double x = A + isSomething * B;
|
I don't think there is a possibility to understand why different datatypes should be added/multiplicated together. And I am not sure about you should ask questions for decompiled code. However, put !alfa[9] in brackets - (!alfa[9]) - and you have a chance it does compile.
edit: Of course you can e.g. multiplicate a double with an integer and assign it to a double.
Thanks kronin, It works!!.
IMO, there is only one reason to use bool * x and only if you think it simplifies the reading of the code. Variations like:
Explicit | Compact |
---|---|
Very intelegent way to solve it.
Thanks WMR
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello freinds,
We say that:
Boolean constants may have the value of true or false, numeric representation of them is 1 or 0, respectively. True or TRUE, False or FALSE can be used, as well.
Examples:
bool a = true; bool b = false; bool c = 1;
Its internal representation is a long 4-byte integer number. Boolean constants can assume the values of 0 or 1.
I have a problem, and I nnd your help:
The code lines are:
...
bool alfa[19];
int beta[50][300];
int gamma[50];
...
alfa[1] = 1;
...
beta[0][11] = alfa[9] * gamma[9] + !alfa[9] * StrToTime("00:00");
My quations are:
Do I right if I say: a bool variable is 0 if it is FALSE, and a bool variable is 1 if it is TRUE?
and:
Why do I get an error massage on the last code line - "=" - assignment expected ?
Please help.
Thanks,