Afficher un message
Vieux 11/03/2008, 08h17   #3
Todd Benson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: is this a feature or a bug?

On Tue, Mar 11, 2008 at 12:59 AM, Rie! <ariekusumaatmaja2@gmail.com> wrote:
> sorry if it's been discussed as i don't know what the search keyword
> for this scenario. it actually came up from _mistype_ (notice the
> comma).
>
> m:~ arie$ irb
> >> h = {}

> => {}
> >> h[:a] = 1,

> ?> h[:b] = 2
> => [1, 2]
> >> h

> => {:a=>[1, 2], :b=>2}


Feature, I think. Otherwise, you wouldn't be able to do things like...

a, b = b, a

The comma, it seems, assumes precedence from the right side.

Todd

  Réponse avec citation
 
Page generated in 0,05313 seconds with 9 queries