function* counter(low: number, high: number, step: number) { let current = low while (current <= high) { yield current current += step }}for (let c of counter(3, 9, 2)) { console.log(c)}//printed 3, 5, 7, 9