What's the effect in Ruby when you initialize with nil: x = String(nil)

Posted by nickl on Stack Overflow See other posts from Stack Overflow or by nickl
Published on 2010-03-19T00:27:39Z Indexed on 2010/03/19 0:31 UTC
Read the original article Hit count: 397

Filed under:
|
|

What's the effect in Ruby when you pass nil to the constructor as in:

s = String(nil)

or

a = Array(nil)

Does this mean that s or a is nil or that s or a is an unpopulated object of type String or type Array?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about initialization