Re: More than one values returned?
| From: | Nick Stinemates | Date: | Wed, 20 Feb 2008 03:27:04 +0000 |
| Subject: | Re: More than one values returned? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-269682@lists.php.net to get a copy of this message | ||
Greg Donald wrote:
> 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/
>
>
Support != good design habits. Please read my other post which explains
the reasoning.
--
==================
Nick Stinemates (nick@stinemates.org)
http://nick.stinemates.org
AIM: Nick Stinemates
MSN: nickstinemates@hotmail.com
Yahoo: nickstinemates@yahoo.com
==================