Home Segments Index Top Previous Next

432: Mainline

Smalltalk comes with many methods that allow you to , convert an instance of one class into an instance of another class. For example, if you create and populate an array, and then wish it were a set, you can arrange a conversion by sending an asSet message:

Workspace
#(570 720 640 720) 
  asSet do: [:element | Transcript show: element printString; space] 
Transcript 
640 720 570