Created
January 12, 2012 11:11
-
-
Save deepak/1599917 to your computer and use it in GitHub Desktop.
about_arrays.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr = [1, 2, 3, 4] | |
puts "arr[3]: #{arr[3].inspect}" | |
puts "arr[4]: #{arr[4].inspect}" | |
puts "arr[5]: #{arr[5].inspect}" | |
puts "arr[3,0]: #{arr[3,0].inspect}" | |
puts "arr[4,0]: #{arr[4,0].inspect}" # why is this [] | |
puts "arr[5,0]: #{arr[5,0].inspect}" # but this is nil | |
__END__ | |
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0] | |
arr[3]: 4 | |
arr[4]: nil | |
arr[5]: nil | |
arr[3,0]: [] | |
arr[4,0]: [] | |
arr[5,0]: nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
molgrew says that it is a fence variable
checked array.c line 948