July 30, 2021

Answer to Collections Q6



The add: message returns the argument and not the receiver. This is a classic Smalltalk "bug". You can avoid this by the use of the yourself message (found in Object), which returns the receiver.

deadPoets := Set new add: 'Milton';
                     add: 'Shakespeare';
                     add: 'Keats';


Back to « Collection Questions 1































































Up to top of page