Learning Objectives
By the end of this lesson you will be able to:
- Apply a decision framework that picks the right structure for a given shape of data
- Use a rule-of-thumb checklist to decide between an inline parameter, a Data Table, and a Doc String
- Recognize how the
Butkeyword fits alongside these structures for negative conditions
The Decision Framework
You now know three tools for carrying data on a step: writing it inline in the sentence, attaching a Data Table, or attaching a Doc String. The remaining skill is choosing correctly and quickly, every time a scenario needs to carry more than one or two atomic facts.
Ask these questions, in order:
- Is it a single scalar value? One number, one string, one boolean. → Put it directly in the step's sentence.
- Is it several related fields, or several rows sharing the same columns? → Attach a Data Table.
- Is it free-form prose or a text/data blob that isn't naturally field-shaped? → Attach a Doc String.
That's the whole framework. The hard part isn't remembering the three options — it's resisting the pull to default to option 1 for everything, which is how walls of And get written in the first place.
A Rule-of-Thumb Checklist
When in doubt, this checklist settles most real cases:
- One value, no structure to it? Just put it in the step. Don't build a table for a single fact.
- More than about three related fields? Reach for a Data Table. Below that, an inline parameter is often still readable; above it, a table pays for itself.
- Free-form prose, a whole document, or a blob you want to preserve verbatim? Reach for a Doc String. Don't invent artificial "field" and "value" labels for something that's really one piece of writing.
- Several records sharing the same shape (multiple existing users, multiple line items)? Reach for a horizontal Data Table with a header row, rather than one step per record.
Applied to the registration example that started this module: ten fields is comfortably past the "about three" threshold, so a Data Table is the right call. A single field like "the user's role" stays inline. A justification paragraph on a loan application is prose, so it's Doc String material, regardless of how long or short it happens to be.
Where But Fits In
From the previous course, you already know But extends a step the same way And does, but signals a negative or contrasting condition — "But the discount code has expired," for instance. But doesn't compete with Data Tables or Doc Strings; it operates at the level of connecting whole steps, while Data Tables and Doc Strings operate within a single step. You can perfectly well write:
Given the following applicant details:
| field | value |
| full name | Jane Doe |
| employer | Acme Corp |
| annual salary | 62000 |
But the applicant has an active bankruptcy flag on file
The Data Table carries the structured facts about the applicant; the But step still carries its own single, contrasting condition. Neither tool replaces the other — they solve problems at different levels of a scenario.
Putting It All Together
The whole point of this module has been to stop treating "more data" as a reason to write "more steps." A step can carry as much structured or free-form data as it needs to, through a Data Table or a Doc String, while the scenario itself stays short: a handful of steps that read as a story, not a form-filling transcript.
Pro Tip: Before adding another
And, ask "am I describing one more fact about the same thing, or restating a data point that belongs in a table or Doc String I should have used two steps ago?"
Key Takeaways
- Ask, in order: is it one scalar (inline), several related fields or rows (Data Table), or free-form prose (Doc String)?
- Roughly three or more related fields is the practical threshold for reaching for a Data Table
- Multiple records sharing the same shape belong in a horizontal Data Table, not one step per record
Butstill extends a step for a contrasting condition — it operates alongside Data Tables and Doc Strings, not instead of them- The goal is a scenario that reads as a short story, with the data structures carrying the bulk instead of extra steps