Re: More than one values returned?
| From: | Greg Donald | Date: | Tue, 19 Feb 2008 22:57:54 +0000 |
| Subject: | Re: More than one values returned? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-269658@lists.php.net to get a copy of this message | ||
On 2/18/08, Nick Stinemates <nick@stinemates.org> wrote:
> I have found, however, that if I ever need to return /multiple/ values,
> it's usually because of bad design and/or the lack of proper encapsulation.
Yeah, that's probably why most popular scripting languages support it.
In Ruby:
def foo
1, 2
end
a, b = foo
In Python:
def foo
return 1, 2
a, b = foo
In Perl:
sub foo
{
return (1, 2);
}
(my $a, my $b) = foo;
--
Greg Donald
http://destiney.com/