Fix English method examples for Ruby's guide (#29102)
This commit is contained in:
@ -33,21 +33,21 @@ mixed_array[2] # true
|
|||||||
You can check how many elements an array has with the `length` method:
|
You can check how many elements an array has with the `length` method:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
mixed_array.length # 3
|
mixed_array.length # 4
|
||||||
[].length # 0
|
[].length # 0
|
||||||
```
|
```
|
||||||
|
|
||||||
You can check the first element of an array with the `first` method:
|
You can check the first element of an array with the `first` method:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
mixed_array.first # 5
|
mixed_array.first # 5
|
||||||
```
|
```
|
||||||
|
|
||||||
You can check the last element of an array with the `last` method:
|
You can check the last element of an array with the `last` method:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
mixed_array.last # true
|
mixed_array.last # [1,2,3]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### More Information:
|
#### More Information:
|
||||||
<a href='https://ruby-doc.org/core-2.4.2/Array.html' target='_blank' rel='nofollow'>Ruby array documentation</a>
|
[Ruby array documentation](https://ruby-doc.org/core-2.4.2/Array.html)
|
||||||
|
Reference in New Issue
Block a user