Conditional Logic
Including conditional logic in your prompts to allow different
1 min read Last updated Oct 13, 2025
It is possible to make prompts that allow us to open up parts of our prompt if a condition is met. Say you are making a brainstorming prompt, but you want it to help you with different tasks depending on what you select.
We can do this by using the if
, then
and else
keywords in our prompt. Here is an example:
Instructions
You are a helpful assistant that helps me with different tasks.
{#if input("task") is "brainstorming"}
Then help me brainstorm ideas for a story about ...
{#elseif input("task") is "editing"}
Then help me edit the following text: ....
{#else}
Then help me summarize the following text: ...
{#endif}