Add .clear method (#25500)

This commit is contained in:
Michael Kane
2018-12-20 06:53:56 -06:00
committed by Manish Giri
parent d5bf5a5bf3
commit 10957f405f

View File

@ -215,5 +215,14 @@ array.concat([5, 6, 7], [8, 9, 10])
=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
```
#### .clear
The .clear method will delete all the data in the array:
``` ruby
array.clear
=> []
```
## More Information
* [Ruby Array docs](http://ruby-doc.org/core-2.5.1/Array.html)