Assign nil to array element : nil « Language Basics « Ruby
- Ruby
- Language Basics
- nil
Assign nil to array element
a = [ 1, 'cat', 3.14 ] # array with three elements
a[0]
# set the third element
a[2] = nil
# dump out the array
p a
Related examples in the same category