Jump to content

Respond to an unknown method call: Difference between revisions

→‎{{header|ooRexx}}: corrected code
m (→‎{{header|Kotlin}}: Corrected capitalization of Firefox)
(→‎{{header|ooRexx}}: corrected code)
Line 822:
=={{header|ooRexx}}==
To respond to unknown method calls, classes can implement an <code>unknown</code> method. This method is passed the name of the method and an array of the arguments that were used on the call.
<lang ooRexx>u = .unknown~new
u = .unknown~new
u~foo(1, 2, 3)
 
Line 829 ⟶ 828:
::method unknown
use arg name, args
say "Unknown method" name "invoked with arguments:" args~tostring('l', ', ')</lang>
</lang>
Output:
<pre>Unknown method FOO invoked with arguments: 1, 2, 3</pre>
<pre>
Unknown method FOO invoked with arguments: 1, 2, 3
</pre>
 
=={{header|Oz}}==
2,295

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.