Skip to content
This repository was archived by the owner on Feb 9, 2022. It is now read-only.
This repository was archived by the owner on Feb 9, 2022. It is now read-only.

Add the function range() #30

@rauschma

Description

@rauschma

Inspired by Python, it could be implemented as follows:

function* range(start=0, end=Infinity, step=1) {
    const posInc = step > 0;    
    while ((posInc && start < end) || (!posInc && start > end)) {
        yield start;
        start += step;
    }
}

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