Skip to main content
Lesson 11 of 16 · Mastering ChatGPT Prompts

Conditional and branched prompts

Lesson 11 of 16 Updated November 5, 2026 Beginner
On this page
  1. Write an “if/then” rule
  2. Combine multiple criteria
  3. Sort an entire list in one pass
  4. Produce multiple versions of the same message
  5. Nest conditions
  6. Use conditions as guardrails
  7. Your turn
  8. Key takeaways

So far, your prompts have followed a linear path: one instruction, one result. Real-world professional situations are rarely that docile. What do you do when the right answer depends on a characteristic you won’t know until you process the case, or when you need to cover multiple scenarios in a single pass? Conditional and branched prompts absorb this variability: instead of writing a separate prompt for each scenario, you write the rule that discriminates among them once.

Write an “if/then” rule

The simplest conditional describes the possible cases and the action associated with each. Imagine you moderate reviews on your business profile: comments arrive daily, mixed together, and they don’t all call for the same response.

Analyze this customer review and respond appropriately.

Rules:
- If the review is positive: thank them warmly and invite
  them to leave a Google review
- If the review is negative: apologize, ask for
  details about the issue, and offer direct contact
- If the review is a question: answer factually and offer
  to take it further by email
- If the review is spam: simply state "SPAM - delete"

Review: "[PASTE REVIEW HERE]"

This single prompt covers four cases and lets you process dozens of reviews without rewriting anything between them. The change is deeper than it appears: you no longer sort upfront to choose the right prompt; the sorting is now part of the instruction.

Combine multiple criteria

When the response depends on two or three variables at once, write your conditions as a decision tree. A career counselor doesn’t give the same advice to a junior professional changing careers as to a senior executive who wants to start a company; the following prompt encodes that discernment once and for all.

You are a professional career counselor.
A candidate provides the following information.
Tailor your recommendations to their profile.

Candidate profile:
- Experience: [JUNIOR (0-2 years) / MID-LEVEL (3-7 years) / SENIOR (8+ years)]
- Current sector: [SECTOR]
- Goal: [ADVANCEMENT / CAREER CHANGE / START A BUSINESS]
- Constraint: [GEOGRAPHIC / SALARY / TIME / NONE]

Adaptation rules:
- If JUNIOR + ADVANCEMENT: focus on skills to acquire
  and relevant training
- If JUNIOR + CAREER CHANGE: emphasize transferable skills
  and suggest concrete bridges
- If MID-LEVEL + ADVANCEMENT: propose positioning strategies
  and targeted networking
- If MID-LEVEL + START A BUSINESS: assess feasibility and propose
  a gradual transition plan
- If SENIOR + ADVANCEMENT: steer toward leadership or
  advisory roles, with personal branding
- If SENIOR + START A BUSINESS: leverage existing expertise
  and network

If GEOGRAPHIC constraint: include remote-first options.
If SALARY constraint: prioritize fast-income options.
If TIME constraint: propose an accelerated plan.

Look at the structure rather than the content: the intersection of experience and goal determines the substance of the advice, while the constraint acts as a filter applied on top of the result. Separating these two levels instead of combining everything avoids writing eighteen rules when nine will do—and lets you add a fourth constraint tomorrow without rewriting the entire tree.

Sort an entire list in one pass

The same mechanism turns a manual qualification task into a single operation. On a leads export, the conditions act as a scoring grid, and the table enforces a deliverable the sales team can use immediately, without reformatting.

Here is a list of 10 sales leads. For each, assess
priority and propose the appropriate follow-up action.

Scoring rules:
- If the lead visited the pricing page: HOT -> propose a call
- If the lead downloaded a white paper: WARM -> send a
  personalized nurturing email
- If the lead only subscribed to the newsletter: COLD -> add
  to the automated sequence
- If the lead requested a demo: VERY HOT -> call within 24h

For each lead, produce:
| Name | Behavior | Score | Recommended action | Personalized message (2 lines) |

Leads:
1. Marie L. - visited pricing + downloaded the "ROI Guide" white paper
2. Thomas D. - subscribed to newsletter 3 months ago, no activity since
3. Sophie R. - demo request received yesterday, company of 200 employees
[...]

One precaution before pasting a list like this: it involves personal data. Check what your plan and your company’s rules allow. On Business, Enterprise, and Edu plans, OpenAI does not use your content to train its models by default; on personal plans, it may be used for training unless you have disabled it in your data controls settings. In any case, keep only the information needed for sorting, for example a first name and an initial rather than a full name and address.

Produce multiple versions of the same message

A useful variant is to ask not for a choice, but for all branches at once. This is the typical situation for a sensitive announcement that must circulate to different audiences without ever contradicting itself from one channel to another.

We are preparing an announcement about a restructuring of the sales team.
Write 3 versions of the message based on context.

Scenario A - Team meeting (direct, transparent tone):
The announcement is made in person to the affected team.
Priority: honesty and addressing concerns.

Scenario B - Internal email to the entire company (factual, reassuring tone):
General information sent to all employees.
Priority: clarity and message stability.

Scenario C - Communication to clients (professional, confident tone):
Message intended for key clients who have a dedicated contact.
Priority: service continuity and trust.

For each scenario, produce:
1. The full message (200 words max)
2. The 3 likely questions and prepared answers
3. The main point of vigilance

Getting all three versions in a single response isn’t just a time saver; it’s a consistency win: the model has the other two in view while drafting each one, which wouldn’t happen if you opened three separate conversations.

Build a condition tree Four steps: describe the possible cases; write an if/then rule for each; include a default case; test with three inputs that trigger different branches. IF, THEN, ELSE Build a condition tree 1 Case Describe the possible cases 2 Rules If…, then… 3 Default A default case 4 Test Three different inputs A vague condition like "if the tone is average" means nothing to the model: make it observable.
Based on the article "Best practices for prompt engineering with the OpenAI API" from the OpenAI Help Center (November 2026).

Nest conditions

For truly complex trade-offs, nest conditions as you would in a scoping note. The example below makes the recommendation depend on a first budget tier, then, within each tier, on a second criterion that isn’t the same everywhere—sales cycle for extreme budgets, market maturity for the middle tier.

Help me choose the best customer acquisition strategy.

Decision parameters:
- Monthly budget: [AMOUNT]
- Sales cycle: [SHORT (< 1 month) / LONG (> 3 months)]
- Market maturity: [MATURE / EMERGING]

Recommendation logic:
IF budget < 5,000 EUR:
  IF cycle SHORT -> SEO + content marketing
  IF cycle LONG -> Organic LinkedIn + email nurturing
IF budget 5,000-20,000 EUR:
  IF market MATURE -> Google Ads + retargeting
  IF market EMERGING -> Content + industry events
IF budget > 20,000 EUR:
  IF cycle SHORT -> Google Ads + LinkedIn Ads + SDR
  IF cycle LONG -> ABM (Account Based Marketing) + events

For each recommendation, detail:
1. Budget allocation by channel
2. KPIs to track
3. Expected results at 3 and 6 months

Use conditions as guardrails

Conditional rules aren’t just for steering content: they can monitor output quality as it’s being written. Each “if” becomes a self-correction instruction the model applies to its own text, instead of leaving you to discover the problem during review.

Write an 800-word blog post on e-commerce trends in 2026.

Guardrails:
- If you mention a statistic, cite the source or indicate
  "estimate" in parentheses
- If you claim a trend is "the most important," justify
  with at least 2 arguments
- If a paragraph exceeds 100 words, split it in two
- If you use a technical term, add an explanation in
  parentheses the first time
- If you can't find a concrete example for a point, flag it
  with [ADD EXAMPLE]

Your turn

Build and test your own decision tree. Choose a task you repeat where the scenarios vary, then fit it into this matrix.

[YOUR RECURRING TASK]

Conditions:
- If [CONDITION A] then [ACTION A]
- If [CONDITION B] then [ACTION B]
- If [CONDITION C] then [ACTION C]
- If no condition applies: [DEFAULT ACTION]

Apply these conditions to:
[YOUR DATA]

Then test with at least three different inputs, chosen to trigger distinct branches. This test almost always reveals one of three classic flaws. A condition phrased in vague terms—“if the tone is average”—means nothing to the model: replace it with an objective criterion, or provide an example of each category. The absence of a default case leaves the model to improvise as soon as an input falls outside the expected frame, and that’s where incongruous responses appear; the “else / in all other cases” line is never superfluous. Finally, beyond six or seven branches, the prompt becomes impossible to maintain: you won’t know which one produced a given result. Simplify, or split it into several chained prompts.

Official sources: Best practices for prompt engineering with the OpenAI API · How your data is used to improve model performance (OpenAI Help Center)

Key takeaways

  • Conditional prompts adapt the response to different cases using “if/then” rules.
  • Multi-criteria branching lets you handle complex situations in a single prompt.
  • Batch processing with conditions automates the analysis of entire lists.
  • Multi-scenario prompts produce several versions tailored to different contexts.
  • Always include a default case and limit the number of branches to maintain clarity.
  • Before processing personal data, check what your plan and your company allow, and minimize data to the strict necessity.