Skip to content

Conditional Looping in Guidance Program #191

Closed Answered by chrisfentiman
rickbraddy-pharma asked this question in Q&A
Discussion options

You must be logged in to vote

The above is a great example, but here is some code to save people time and effort searching for answers.

{{#geneach 'some-var' stop=False}}
... do something
{{#if (some conditional)}}{{break}}{{/if}}
{{/geneach}}

You can use a geneach to continuously loop until your condition is met. Once met, you can use the break provided by guidance to break from the loop. This will then go ahead and execute the rest of your prompt as expected.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@rickbraddy-pharma
Comment options

Answer selected by rickbraddy-pharma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants