mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-01-12 23:18:03 -05:00
24 lines
380 B
TypeScript
24 lines
380 B
TypeScript
//! test_output({"iter":[4,5,6,7,8,9],"iterSnapshot":[2,3,4,5,6,7,8,9]})
|
|
|
|
export default function main() {
|
|
let iter = iUntil(10);
|
|
iter.next();
|
|
iter.next();
|
|
|
|
let iterSnapshot = iter;
|
|
|
|
iter.next();
|
|
iter.next();
|
|
|
|
return {
|
|
iter: [...iter],
|
|
iterSnapshot: [...iterSnapshot],
|
|
};
|
|
}
|
|
|
|
function* iUntil(n: number) {
|
|
for (let i = 0; i < n; i++) {
|
|
yield i;
|
|
}
|
|
}
|