Skip to content

Session 1 Notes: 19-nil.rb maybe explain | and {}? #18

@paoyong

Description

@paoyong

Going through the tutorial right now, I am confused as to what the {...} and the |number|mean in these two lines:

array.find { |number| number * 2 == 10 } # => 5
array.find { |number| number * 2 == 11 } # => nil

Could not find an explanation in earlier notes so I had to look them up. Figured it out in the end on my own, but it would be nice if a note covered this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions