Skip to content

Alternative implementation #1

@ingydotnet

Description

@ingydotnet

Nice job!

Here's an alternative that should be easily doable with pyyaml.

- !repeat
  - 3
  - - !say Please guess a number
    - !read number
    - !if
      - [ ==, !get number, 777 ]
      - - !say That was correct!
        - !break
      - !say Try again!

I'll leave the runner as an exercise.

Full disclosure, I am a creator of the YAML language and current maintainer of pyyaml. :)

Check out https://play.yaml.io/main/parser?input=LSAhcmVwZWF0CiAgLSAzCiAgLSAtICFzYXkgUGxlYXNlIGd1ZXNzIGEgbnVtYmVyCiAgICAtICFyZWFkIG51bWJlcgogICAgLSAhaWYKICAgICAgLSBbID09LCAhZ2V0IG51bWJlciwgNzc3IF0KICAgICAgLSAtICFzYXkgVGhhdCB3YXMgY29ycmVjdCEKICAgICAgICAtICFicmVhawogICAgICAtICFzYXkgVHJ5IGFnYWluIQo=

Also feel free to stop by https://matrix.to/#/#chat:yaml.io and say Hi sometime.

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