Respond to an unknown method call: Difference between revisions

Content added Content deleted
(Added Io entry)
Line 438: Line 438:
end
end
end</lang>
end</lang>

=={{header|Io}}==
Translation of Python.

<lang io>Example := Object clone do(
foo := method(writeln("this is foo"))
bar := method(writeln("this is bar"))
forward := method(
writeln("tried to handle unknown method ",call message name)
if( call hasArgs,
writeln("it had arguments: ",call evalArgs)
)
)
)

example := Example clone
example foo // prints "this is foo"
example bar // prints "this is bar"
example grill // prints "tried to handle unknown method grill"
example ding("dong") // prints "tried to handle unknown method ding"
// prints "it had arguments: list("dong")"
</lang>


=={{header|J}}==
=={{header|J}}==