When you perform an operation with operands that are different datatypes, ODL converts the operand on the right to the datatype of the operand on the left, then performs the operation. ODL then converts the result to the datatype of the variable on the left of the equal sign, if necessary, before placing that result into the variable.
In the example below, the value of my_float
is
converted to an integer before adding it to my_int
.
The result of my_int + my_float
is
then converted to float
before
it is stored as the value for the answer. For example:
int my_int = 5; float my_float = 10.2; float answr;
answr = my_int + my_float;
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |