Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generators/Yield #2

Open
3 tasks
jprochazk opened this issue Feb 20, 2023 · 0 comments
Open
3 tasks

Generators/Yield #2

jprochazk opened this issue Feb 20, 2023 · 0 comments

Comments

@jprochazk
Copy link
Owner

jprochazk commented Feb 20, 2023

Tasks

  • Syntax
  • Emit
  • Runtime

Syntax

fn counter(n, step, end=none):
  loop:
    yield n
    n += step
    if end != none && n > end:
      return

for n in counter(0, 10, 100):
  print(n)

fn even(end=none):
  yield from counter(2, 2, end)

for n in even(100):
  print(n)

Emit

TBD

Runtime

TBD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: No status
Development

No branches or pull requests

1 participant