Skip to content

Support Ruby-style block arguments #1054

Closed
@marijnh

Description

@marijnh
uint::range(0, 10) {|x| ... };
mymap.each {|key, val| ...};

A block ({ followed by | or ||) appearing after an expression is (with the same precedence as x.y, x[y], x(), etc) treated as a block value passed to a function. If the expression was a call, the block argument is added as a last argument. If it was a non-call, it becomes a call with a single argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions