Content deleted Content added
No edit summary |
JustinCasey (talk | contribs) m simple spelling corrections |
||
Line 7:
In some programming languages an operator may work with more than one kind of data, (such as in [[Java programming language|Java]] where the <tt>+</tt> operator is used both for the addition of numbers and for the concatenation of strings). Such an operator is said to be ''overloaded''. In languages that support [[operator overloading]] by the programmer, such as [[C Plus Plus|C++]], one can define customized uses for operators; in [[Prolog]], one can also define new operators.
Some languages also allow for the operands of an operator to be of different data types, in which case one of them is ''coerced'' to the data type of the other, to permit the operation to occur. For example, in [[Perl]] <tt>12 + "3.14"</tt>, causes the text <tt>"3.14"</tt> to be coerced to a number and produces the result <tt>15.14</tt>. The text <tt>"3.14"</tt> must be transformed into the value 3.14 befor addition can take place. Also 12 is an integer and 3.14 is either a floating or fixed point number (a number the has a decimal place in it) Therefor the integer must be then converted to a floating point or fixed point number. This is however
In older languages like C. The union was used
Line 18:
</code>
to allow
{{comp-stub}}
|