Send an unknown method call: Difference between revisions

Content added Content deleted
Line 130: Line 130:
^ 42 + x ] ].
^ 42 + x ] ].


name := 'foo:' asSymbol. " same as name := #foo: "
symbol := 'foo:' asSymbol. " same as symbol := #foo: "


Example new perform: name with: 5. " returns 47 "</lang>
Example new perform: symbol with: 5. " returns 47 "</lang>


The <code>perform:with:with:</code> family of methods exist for methods with 0 - 2 (3 in GNU Smalltalk) arguments. For methods with more arguments, use <code>perform:withArguments:</code>, which takes an array of arguments.
The <code>perform:with:with:</code> family of methods exist for methods with 0 - 2 (3 in GNU Smalltalk) arguments. For methods with more arguments, use <code>perform:withArguments:</code>, which takes an array of arguments.