Computer Science Canada returning multiple values |
Author: | ilovechicken [ Tue May 17, 2005 7:43 pm ] |
Post subject: | returning multiple values |
when i have written a method and want it to return multiple values to the method that called it how do i do it? the only way i know so far is in the method that is doing the calling write a line like; variable = methodName (); and in method name: public boolean methodName () { return true; } but this can only return one variable at a time... |
Author: | wtd [ Tue May 17, 2005 8:04 pm ] | ||
Post subject: | |||
You either have to return an array, or some other collection or write a class yourself that wraps several values. Something like:
Convenient, isn't it? :: silently points to all of the languages that *can* do this easily :: |