Commit f02694ec authored by Lukas Elmer's avatar Lukas Elmer Committed by GitHub

Update documentation of fetch

The sentence `Negative values of +index+ count from the end of the array.` can be interpreted that it only holds if a block is given. Clarify it.
parent cc3f1b7f
...@@ -275,8 +275,9 @@ class Array ...@@ -275,8 +275,9 @@ class Array
# +default+ value. # +default+ value.
# #
# Alternatively, if a block is given it will only be executed when an # Alternatively, if a block is given it will only be executed when an
# invalid +index+ is referenced. Negative values of +index+ count from the # invalid +index+ is referenced.
# end of the array. #
# Negative values of +index+ count from the end of the array.
# #
# a = [ 11, 22, 33, 44 ] # a = [ 11, 22, 33, 44 ]
# a.fetch(1) #=> 22 # a.fetch(1) #=> 22
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment