What if-then statements, residual clauses, and a great many sentencing memos taught me about working with AI.
Lawyers like to say they went to law school because they were bad at math, which, in my experience, is mostly untrue. A good deal of legal work is logic with a dress code. A statute sets out conditions and consequences. A contract assigns obligations that switch on when certain things happen and switch off otherwise. An elements test is a list of requirements that all have to be true at once, and any lawyer who has spent an afternoon arguing over whether the "and" in a statute really means "and" knows more about Boolean logic than they would ever care to admit.
I have spent most of my career with one foot in each world. For about fifteen years I practiced federal litigation, and for most of that same stretch I also ran an ERP consulting practice, moving companies' financial data between systems that each had firm and incompatible views on what a customer was. I did not set out to prove that lawyers and programmers think alike, but doing both jobs in the same week tends to make the point for you. The overlap is larger than either profession appreciates, and I think it explains a lot about why so many lawyers find AI tools frustrating.
Lawyers already write code
Take an ordinary contract clause. If the buyer fails to pay within thirty days of the invoice, then the seller may suspend delivery. That is an if-then statement, and a programmer would recognize it immediately, though they would probably want to know what counts as "pay" and which time zone the thirty days run in (questions a careful lawyer would ask too, which is rather the point).
The similarities keep going once you look for them. A definitions section is a list of variables declared at the top of the file so that nobody has to guess what "Affiliate" means on page forty. A cross-reference to Section 4.2(b) is a function call. Boilerplate is a library of code that has been reused so many times that nobody reads it anymore, which in both professions is exactly when it causes trouble. And a statute that applies "unless otherwise provided in this chapter" is a conditional with its override buried somewhere else, the kind of thing a programmer would flag in a code review and a lawyer would bill for finding.
Where the two professions part ways is mostly vocabulary. Programmers write their logic in a language strict enough that a machine can run it, and lawyers write theirs in English strict enough that a judge can enforce it, which is a lower bar for precision and a much higher bar for argument.
The trouble with covering every contingency
When a project gets complicated, whether it is a data migration, a case strategy, or a new intake process, my instinct is to build an if-then structure that covers every possible contingency. If the client says this, we do that. If the record is missing a date, we pull it from here. If that field is blank too, we try something else. Lawyers are trained to think this way. We are paid, more or less, to imagine every way a thing can go wrong and write it down before it does.
It does not work, of course, or at least not completely. The world produces new situations faster than anyone can list them, and somewhere around the fourteenth nested condition you realize you are no longer planning a project so much as cataloguing every way it might fail.
Lawyers have known this for a long time, which is why legal drafting is full of quiet admissions that the list will never be complete. "Including but not limited to" is one. A force majeure clause is another, a whole paragraph that exists because nobody can predict the next flood, strike, or pandemic, so the parties agree ahead of time on what happens when the unpredictable shows up. The Federal Rules of Evidence spend a few dozen exceptions trying to describe every reliable kind of hearsay and then, having run out of steam, add a residual exception for statements that fit none of them but are trustworthy anyway (Rule 807, for those keeping score).
In programming, that last branch has a name. It is the else.
What the else is for
The else is the part of an if-then statement that runs when none of the conditions you planned for turn out to be true. New programmers tend to treat it as an afterthought, a place to put "carry on as usual." Experienced programmers treat it with more respect, because they have learned that the else is where the surprises go.
A good else does one of a few things. It can stop and report that something unexpected happened, which programmers call failing loudly (it is far better than failing quietly and discovering it three months later in an audit). It can set the odd case aside for a human to look at. It can loop back to the beginning and ask the question again with better information. What a good else should almost never do is pretend nothing happened and keep moving.
My ERP work demonstrated this well. Every data migration I ran had an exceptions report, a list of the records that did not match any of the mapping rules we had so carefully written: a customer with two billing addresses, an invoice dated in the year 2109, a vendor who appeared to be the same company under three spellings. The exceptions report was the else, and it was usually the most valuable document in the project, because it showed exactly where our assumptions about the data were wrong. A migration that came back with no exceptions at all made me more nervous than one that came back with five hundred.
So I have come to think of the else less as the place where the logic runs out and more as a marker in the work, a spot where you are allowed (expected, really) to stop, pause, and think about what to do next. You can go back to the start. You can ask a question you did not know to ask the first time. You can decide the whole approach was wrong. Any of those beats plowing ahead as though the unexpected case were just another row.
Criminal sentencing has the same structure, and I spent a good part of my career living in its else. The federal sentencing guidelines are, at bottom, a very large if-then table. Find the offense level, add points for this, subtract for that, work out the criminal history category, and read the range off a grid. Since Booker, though, the guidelines have been advisory, and the judge must also weigh the factors in 18 U.S.C. § 3553(a), including the history and characteristics of the defendant. That statute is the else. It is where the system concedes that the table cannot capture everything about a person, and it is where every sentencing memo I wrote did its real work.
Prompting is programming in plain English
Which brings me to AI, and to the lawyers who tell me, with a certain weariness, that they tried it and it made things up.
Writing a prompt for a large language model is programming, done in conversational English instead of Python. You set out conditions, describe what should happen under each, give it steps to repeat, and tell it when to stop. The model does not need semicolons, but it does need logic, and it will follow the logic you give it with an unnerving willingness to fill in whatever you left out.
That last part is where lawyers tend to get burned. Most of us ask an AI tool for something the way we would ask a capable associate: draft a motion to compel based on these discovery responses. A capable associate would come back with questions. When is it due? Did we meet and confer? Do you want the privilege log issue in this motion or a separate one? The AI, unless told otherwise, does not ask. It treats every gap in the instructions as permission to guess, and it guesses in the same confident tone it uses for everything else. The prompt had an if and a then. It had no else, so the model supplied its own, and the model's default else is to keep going.
The fix is to write the else yourself. "If you cannot find support for a point in the documents I gave you, say so and do not draft that section." "If the facts do not support the motion, tell me before you draft anything." "If a case is not among the ones I attached, flag it instead of citing it." Those sentences do the same job as the exceptions report. They give the model an approved place to put its uncertainty, and they turn the moment it does not know into a stopping point instead of an invention.
Loops work the same way. "Draft the argument, then check every factual statement against the deposition excerpts, and revise anything you cannot support" is a loop with an exit condition, the kind of thing a programmer would write as a while statement and a senior partner would write on a sticky note. Neither of them would be surprised that it improves the result.
You do not need to learn Python for any of this. You only need to notice that lawyers already think in conditions and exceptions, and bring that habit to the prompt.
The best supervisors always wrote an else
The lawyers I learned the most from had a habit I did not fully appreciate until much later. When they handed off an assignment, they nearly always ended with some version of "and if anything looks off, come find me before you go any further." I used to hear that as caution. I now hear it as good programming. They knew they had not anticipated everything, and they wanted the surprises brought back to them rather than buried in a draft.
That is the instruction most lawyers leave out when they hand work to an AI, and it may be the one that matters most. Nobody will ever write an if-then structure that covers every contingency, whether in a contract, a migration, a sentencing memo, or a prompt. What you can do is decide ahead of time what happens when you reach the edge of what you planned for. Leave room for the else, and make it a place to stop and think rather than a place to keep going.