Skip to content

Add a case for Range input #3

@Israel-Laguan

Description

@Israel-Laguan

def my_each
for i in 0...size
yield(self[i])
end if block_given?
to_enum unless block_given?
end

Please add a case for something like this

(1..3).my_each { |i| p i }

If self.is_a?(Range) you can convert self to array.

The same for #my_each_with_index and #my_inject

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