x,xx = *nil
p x.class => NilClass
p xx.class => NilClass
x, xx= *YAML.load("")
p x.class => FalseClass
p xx.class => NilClass
Feature or bug ?
x,xx = *nil
p x.class => NilClass
p xx.class => NilClass
x, xx= *YAML.load("")
p x.class => FalseClass
p xx.class => NilClass
Feature or bug ?
On 7/12/07, Michel D. [email protected] wrote:
x,xx = *nil
p x.class => NilClass
p xx.class => NilClassx, xx= *YAML.load(“”)
p x.class => FalseClass
p xx.class => NilClassFeature or bug ?
irb -r yaml
irb(main):001:0> YAML.load(“”)
=> false
So the return value from load is in a and as there are no more values,
the rest of the variables (in this case xx) gets nil
Without * the results are the same:
irb -r yaml
irb(main):001:0> x,xx = nil
=> [nil]
irb(main):002:0> p x.class
NilClass
=> nil
irb(main):003:0> p xx.class
NilClass
=> nil
irb(main):004:0> x, xx= YAML.load(“”)
=> [false]
irb(main):005:0> p x.class
FalseClass
=> nil
irb(main):006:0> p xx.class
NilClass
=> nil
Luis P. wrote:
So the return value from load is in a and as there are no more values,
the rest of the variables (in this case xx) gets nil
Without * the results are the same:
Thanks, MD
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs