Anonymous user
Polymorphic copy: Difference between revisions
→{{header|REXX}}: added the REXX computer programming language.
(→{{header|REXX}}: added the REXX computer programming language.) |
|||
Line 1,790:
(#<class:point/color%> 0 0 black)
#f</pre>
=={{header|REXX}}==
In the REXX language, every variable is a string (whether or not they contain characters or numerals).
<br>However, a variables' type can be determined from it's attributes (datatypes)
<lang rexx>/*REXX program to copy (polymorphically) one variable's value into another variable. */
b= 'old value.'
a= 123.45
b= a /*copy a variable's value into another.*/
if a==b then say "copy did work."
else say "copy didn't work." /*didn't work, maybe ran out of storage*/
/*stick a fork in it, we're all done. */</lang>
Programming note: Most REXXes will raise a syntax error if an assignment (copy) fails, but it's not guaranteed to do so.<br><br>
=={{header|Ruby}}==
|