Add sub array includes in ruby

This commit is contained in:
Wilfried OLLIVIER 2020-04-17 14:37:11 +02:00
parent 3ec1848c3e
commit be6d34ff20

View file

@ -1,6 +1,14 @@
# Check if all array elements are equals # Playing with arrays
## Check if all array elements are equals
```ruby ```ruby
arr = [0, 0, 0, 0, 0, 0, 0] arr = [0, 0, 0, 0, 0, 0, 0]
puts true if arr.uniq.length == 1 puts true if arr.uniq.length == 1
``` ```
## Array includes a sub array
```ruby
(subarray & array) == array
```