Project

General

Profile

Actions

Feature #8361

closed

Alternative syntax for block parameter

Added by alexeymuranov (Alexey Muranov) almost 11 years ago. Updated almost 11 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:54749]

Description

=begin
I propose an alternative syntax for block parameters:

p = lambda [x] {
# do whatever you like with x here, but be sure to return the result
}

instead of

p = lambda { |x|
# ...
}

This would be consistent with the syntax of procedure call: (({p[a]})).

Also, compare:

a_bunch.each [element] do
# ...
end

with:

a_bunch.each do |element|
# ...
end

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0