[Object] learn: [String] means: [String]. | Manual

[Object] learn: [String] means: [String].

Teaches any object to repsond to the first specified message just like it would upon receiving the second. This allows you to map existing responses to new messages. You can use this to translate messages into your native language. After mapping, sending the alias message will be just as fast as sending the original message. You can use this to create programs in your native language without sacrficing performance. Of course the mapping itself has a cost, but the mapped calls will be 'toll-free'.
Usage:


 #in this example we'll map a message to a Dutch word:

 Boolean learn: 'alsWaar:'
         means: 'ifTrue:'.

 (2 > 1) alsWaar: {
   Pen write: 'alsWaar means ifTrue in Dutch'.
 }

back to homepage
back to manual menu

This API reference guide has been generated automatically from source code comments using the shtml.ctr script.