~
returns the result of the method. Using ~~
returns the object that received the message. Here is an example:
Example 1.19. Messages
/* Two ways to use the INSERT method to add items to a list */ /* Using only ~ */ team = .list~of("Bob","Mary") team~insert("Jane") team~insert("Joe") team~insert("Steve") say "First on the team is:" team~firstitem /* Bob */ say "Last on the team is:" team~lastitem /* Steve */ /* Do the same thing using ~~ */ team=.list~of("Bob","Mary") /* Because ~~ returns the receiver of the message */ /* each INSERT message following returns the list */ /* object (after inserting the argument value). */ team~~insert("Jane")~~insert("Joe")~~insert("Steve") say "First on the team is:" team~firstitem /* Bob */ say "Last on the team is:" team~lastitem /* Steve */