Home Segments Index Top Previous Next

110: Mainline

Cascading works for any kind of message and any number of expressions. In the following, for example, cascading is used to combine three show: keyword messages:

Integer method definition • instance 
displayFatCalories 
  Transcript 
    show: 'There are '; 
    show: (self * 9) printString; 
    show: ' calories in the fat' 

Note that aligning the show: selectors in display expressions makes those statements easier to read.