Skip to content

Is there a reason to use an iterator rather than an array? #88

@Arlen22

Description

@Arlen22
class TryResult extends Array {
  constructor(ok, val){
    super(3);

    if(!ok) { this.ok = false; this.error = val; }
    else { this.ok = true; this.value = val; }

    this[0] = this.ok
    this[1] = this.error;
    this[2] = this.value;

  }
}

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