22 Jul 2004 20:41
Re: Splitting into a tuple
On 22 Jul 2004, at 18:56, John Wilson wrote:
>
> On 22 Jul 2004, at 18:42, Daniel Serodio wrote:
>
>> What's the syntax for splitting (or "unpacking") into a tuple? I
>> tried the following:
>>
>> pair = "1,2"
>> (x, y) = pair.split(",")
>> [x, y] = pair.split(",")
>> {x, y} = pair.split(",")
>>
>> None of them worked...
>>
>
> Groovy doesn't support this functionality (at least not at the moment!)
Agreed - there's a JIRA issue for this somewhere.
today you have to do the long winded
a = pair.split(",")
x = a[0]
y = a[1]
I hope we can add tuple support soon.
James
-------
http://radio.weblogs.com/0112098/
RSS Feed