mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	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. Patch by: Lukas Elmer <lukas.elmer@gmail.com> (@lukaselmer) Signed-off-by: Akira Matsuda <ronnie@dio.jp> closes #1472 [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									a01c388465
								
							
						
					
					
						commit
						f12003d372
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		
							
								
								
									
										5
									
								
								array.c
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								array.c
									
										
									
									
									
								
							|  | @ -1382,8 +1382,9 @@ rb_ary_last(int argc, const VALUE *argv, VALUE ary) | |||
|  *  +default+ value. | ||||
|  * | ||||
|  *  Alternatively, if a block is given it will only be executed when an | ||||
|  *  invalid +index+ is referenced.  Negative values of +index+ count from the | ||||
|  *  end of the array. | ||||
|  *  invalid +index+ is referenced. | ||||
|  * | ||||
|  *  Negative values of +index+ count from the end of the array. | ||||
|  * | ||||
|  *     a = [ 11, 22, 33, 44 ] | ||||
|  *     a.fetch(1)               #=> 22 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 a_matsuda
						a_matsuda