An open API service indexing awesome lists of open source software.

https://github.com/joelibaceta/30-seconds-of-ruby

A curated collection of useful Ruby snippets that you can understand in 30 seconds or less.
https://github.com/joelibaceta/30-seconds-of-ruby

Last synced: 2 months ago
JSON representation

A curated collection of useful Ruby snippets that you can understand in 30 seconds or less.

Awesome Lists containing this project

README

        

# 30 seconds of code

> Note: This project is inspired by 30 Seconds of Code, but there is no affiliation with that project.

### 📚 Array

View contents

* [`any?`](#any?)

---
## 📚 Array

### any?
Passes each element of the collection to the given block. The method returns `true` if the block ever returns a value other than `false` or `nil`.

```ruby
%w[ant bear cat].any? { |word| word.length >= 3 } #=> true
%w[ant bear cat].any? { |word| word.length >= 4 } #=> true
[nil, true, 99].any? #=> true
```