>>>>> "Charles" == Charles Gray <
[hidden email]> writes:
Charles> Is it possible to pass multiple parameters to a method? Suppose I want
Charles> to have a method that solves for x in the quadratic equation, ax^2 +
Charles> bx +c =0. We know the equation is ((-b + (b*b -4*a*x) sqrt))/(2*a). I
Charles> want to pass a, b, and c to a method that might be called
Charles> quadraticSolution. This is a hypothetical question but its answer will
Charles> help me with something on which I am working.
The method name reflects the number of parameters:
anObject unaryMessage. "unary message takes no parameters"
anObject + anotherObject. "binary message is punctuation, takes one parameter"
anObject takes: aParameter and: anotherParameter "keyword message"
A keyword message takes one parameter following each colon-terminated word.
In this case, the name of the message is "takes:and:".
For a solver, you'd probably have:
result := theSolver solveQuadraticEquationForA: a andB: b andC: c.
or something like that.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<
[hidden email]> <URL:
http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See
http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners