Jump to content

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 &nbsp; (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: &nbsp; Most REXXes will raise a syntax error if an assignment (copy) fails, but it's not guaranteed to do so.<br><br>
 
=={{header|Ruby}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.