X++ performs automatic conversion of reals to Booleans, enums, and integers in expressions, depending on the result of the expression.
If the result is an integer or the operator is an integer-operator, reals are converted into integers. If the result is a Boolean, reals are converted to Booleans, and so on. For example:
void main()
{
//Declares a variable of type integer with the name exprValue
int exprValue;
//Declares a real variable with the name area
real area = 3.141528;
;
exprValue = Area/3;
}
The expression Area/3 is a real expression because division is a real operator, and the result is 1.047176. This result is automatically converted (actually truncated) to an integer with the value 1, because exprValue is an integer.