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

Best practice for nested code? #34

Open
olyerickson opened this issue Dec 15, 2015 · 1 comment
Open

Best practice for nested code? #34

olyerickson opened this issue Dec 15, 2015 · 1 comment

Comments

@olyerickson
Copy link

I discovered "the hard way" a way to do nested code (loops, etc) --- inserting an @EnD before the next level, then inserting a @begin at the next level. This captures the fall-through (open loop?) logic but doesn't get the "spirit" of the nesting.

What do you recommend for representing nesting?

@tmcphillips
Copy link
Member

You can model your script as a set of nested code blocks each delimited with @begin and @end. For example, the following (if each line appears in a comment) declares that block A contains block B which contains block C:

@begin A
@begin B
@begin C
@end C
@end B
@end A

Code can appear between any of the YW annotations above, and there can be multiple code blocks nested within any other code block. However, if the blocks aren't properly nested you'll get an exception.

Data flow between levels is achieved in the same way that workflow ports are connected to ports on code blocks at the top level of the workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants