Learn how to add multiple messages based on loop conditions in your prompts
else
clause.for
and endfor
keywords, wrapped in {{ }}
. The content inside the loop is repeated for each item in the list.
index
parameter to track the iteration count, starting from 0
.
else
else
clause runs when the list is empty. Place it before the endfor
keyword.
{{ item || "Unknown" }}
if
statements inside loops for conditional logic.endfor
is present and properly matched with for
.else
for Debugging: Add an else
clause to confirm whether the list is empty.Ready for more dynamic control? Explore Conditional Statements to complement your loops.