Photo by Kara Phelps

It’s been four weeks since I started learning to code, and I’m prepared to reveal some deep truths . . . about improv comedy.

Turns out my JavaScript lessons on Codecademy have a lot in common with my improv lessons at the DSI Comedy Theater.

#### 1. Small Choices Build a Complex Reality

The two magic words of improv are “yes—and.” By agreeing with your scene partner and then building on their suggestion, you can create complex worlds from simple ideas. You agree on an escalating set of truths and then explore the result.

“Yes, we’re in a submarine. And you and I are the only living crewmembers. And the only food we have left is an eight-pound vat of cheese curd.”

JavaScript can work the same way. You set up your top-level functions and loops to lay the contextual groundwork for everything that comes later. “If x is true, check if y is true. If y is true, check if z is true. If z is true, print ‘4, 8, 15, 16, 23, 42.'”

In both cases, your initial choices provide vital context for everything that comes afterwards.

#### 2. It’s All About Patterns

Comedy is all about patterns. Many improv scenes start with a verbal pattern game where players associate one word with another before looping back to the original suggestion.

Comedy also has the Rule of Threes. You give three instances of a premise, escalating it each time. Dog eats homework. Dog eats college diploma. Dog eats mortgage application. After the third instance of the pattern, it’s usually smart to break the pattern and find another game to play. Otherwise, the show’s momentum crashes.

Coding is all about patterns, too. That’s the essence of JavaScript loops. You check to see if something is true, run some code, and repeat. Just like in comedy, you need to make sure the pattern will break eventually and not just repeat forever. Otherwise, the computer program crashes.

#### 3. Confidence Trumps Skill

On an improv stage, you arrive with no idea of what scene you’ll be playing in, or even what character you’ll be playing. Since improv classes can’t prepare you for any specific moment, you learn skills to prepare for every moment.

Improv offers an acting toolbox for facing the chaos, a navigation system for uncertainty. You gain confidence even when you don’t really know what you’re doing which, in improv, is 100% of the time.

I’ve found that my coding lessons have made me more confident as well. Not because I’ll necessarily remember every lesson, but because I’m developing an intuitive sense of what code is capable of.

As I mentioned in my first dispatch, I’m learning how to ask the right questions even though I don’t (and can’t ever) know all the answers. The Sea of Coding Knowledge stretches to an infinite horizon. That can be overwhelming. But learning to code has given me the confidence to sail on.