'What does `&:` mean in this Ruby snippet? [duplicate]
This is from a solution I saw at a competitive programming site:
gets.split.map &:to_i
The &:to_i phrase seems to be equivalent to {|s| s.to_i}, but I can't find anything about that syntax at ruby-doc.org, or a match for "&:" [ruby] here. (I don't know what to call it for an English language search, either.)
If it matters, that site is using Ruby 3.0.1.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
