Home Segments Index Top Previous Next

172: Mainline

You introduce local variables into a method by listing those variables between vertical bars in front of the first statement in the method. In the following method, three variables multiplier and multiplicand, and result are introduced, but are not used:

Integer method definition • instance 
fatToCalories 
  | multiplier multiplicand result | 
  ^ self * 9