Building Concrete Productive Habits Through Conditional “If-Then” Logic

“21 days is all it takes to form a new habit!”

Ever heard this old adage? Well, it turns out that it just might be… total bullshit.

But before we grab our debunking hammer and start swinging at every barrel of adages we see rolling toward us, let’s get down to the real business at hand.

Yes, I’m talking about habit formation.

We’ve talked about how beneficial it is to build strong habits before; essentially, doing so lets you use your limited amount of willpower on other things, ensuring you get more done on any given day.

What I didn’t talk much about before is how difficult it can be to build those habits.

Even if the whole “21-day” thing were true, that’s still three weeks you’d have to spend forcing yourself to do something before it became a habit.

Three weeks forcing yourself to get up at 6AM.

Three weeks forcing yourself to go to the gym every day.

Three weeks forcing yourself to write 1000 words a day.

Three weeks forcing yourself to jump off the roof of your apartment so you can become a professional stuntman someday. Thanks for the health insurance, dad!

Every habit you try to build requires an initial commitment of willpower that you weren’t having to spend before.

In addition, you’ve got to deal with all your other daily demands – both the regular ones that crowd your schedule and the unexpected ones that throw a wrench into everything.

So you might now be thinking:

“How can I make the process of habit-formation easier? Is there some super-secret technique that’ll help? Do I need to climb 10,000 steps to some temple in the far east and have monks teach it to me?”

Yes, there exists such a technique.

Luckily for you, I went and learned it from the monks myself. For the record, there were 10,114 steps.

Reaching the Top Step

…this I did, after an arduous 26-minute climb from the bottom. See, I usually take steps five at a time, but it was raining so hard that I had to go down to three. Safety first.

This was taken at step #10,078 – I swear.

This was taken at step #10,078 – I swear.

The monks welcomed me immediately as one of their own – and by “immediately”, I mean “immediately after sending me back down the steps for a case of water”.

Apparently they had no use for the rare blue flower I had brought them, and remembering the quizical looks they gave when I presented it reminds me that I now have a major bone to pick with Christopher Nolan.

Anyway, being the sensitive and culturally aware American I am, I decided to cut right to the chase and ask about the technique I’d come to learn.

“When do I get to meet Ra’s al Ghul?” I asked, directing my query to the nearest monk.

“You mean the Jao Aawaat, my friend”, the monk answered with a warm smile, right after delivering a swift kick to the abdomen for my insolence.

“Right after you clean up that blood you just rudely spit onto the floor,” he continued, “and complete six months of training.”

The light of several candles in a corner flickered across my face while I did the mental math. Six months…. that’s, like, half of a year! I certainly did not have time for that.

Luckily, that’s what montages are for.

15 minutes later, six months had passed. I now faced the head of the monastery and prepared to learn the ultimate technique of habit-building.

“The technique is inside you, my friend. You’ve known it all along.” he told me.

I thought for a moment.

“Oh yeah, you’re right.”

The Secret Technique

I had known the technique all along – and by that, I mean I actually used to use it all the time. And it’s very effective.

Somewhere along the way, I stopped practicing it. Eventually I ceased to think about, and during the past year my attempts at habit-formation have been based more around things like to-do lists. And self-loathing. All those days I was too lazy to jump off of my apartment roof….

However, I was recently reminded of the technique through a game I’ve been playing. That game is Magic: the Gathering, which I’ve discovered to be a superbly complex and rewarding game of strategy and customization.

Even if you’ve never played the game itself, I think I only have to give you one example to reveal the habit-building technique I’m talking about here:

Indrik Stomphowler

There it is, right on the card:

“When Indrik Stomphowler comes into play, destroy target artifact or enchantment.”

In MtG, this is called a triggered ability.

If you’ve ever done any basic programming, though, you’ll recognize this as a conditional statement.

Usually these are written in an “If-Then” format. Pretty much every programming language uses them, and they basically tell the computer:

“If Event X happens, then do Event Y.”

Here’s an example using actual code, in case you’re curious:

if (strlen($password)>25 || strlen($password)<6)
echo "Password must be between 6 and 25 characters.";

This code basically says “If the user’s chosen password is more than 25 characters or less than 6, then display a message telling them the length requirement.”

Conditional logic is pretty simple, and you’ll find it everywhere if you look hard enough. In fact, conditionals are ingrained right into the behaviors of the most basic lifeforms:

If it’s trying to eat me, then GTFO.

And likewise, they’re found right at home in the high-functioning brains of modern humans:

If it’s trying to eat me, then give it a stern look, because it can probably be reasoned with. OH GOD WHERE DID MY LEGS GO

…alright, maybe the human brain doesn’t always make the most rational decisions.

But that’s exactly why conditional logic can be so powerful for habit-building. Before we get into the specifics, though, let’s learn a bit about how habits are actually formed:

Debunking the 21-Day Myth

The American Journal of Psychology defined habits like this:

“A habit, from the standpoint of psychology, is a more or less fixed way of thinking, willing, or feeling acquired through previous repetition of a mental experience.”

Habits are behaviors that are often performed subconsciously. New habits are difficult to form, but you can do it through repetition.

To be more clear, habits are formed through a process called context-dependent repetition.

Basically, when you frequently perform a specific action inside a given context – making a smoothie when you come home from school, for example – a mental link starts to form between that context (coming home) and the action (making the smoothie).

Eventually, the action is performed enough times within the context that a habit is formed.

Now, while we know that much to be true, the whole “You can form a new habit in just 21 days!” advice stands on shakier ground. In fact, researchers at University College London tracked down this commonly cited anecdote’s source, finding it to be a passage from a 1960 book called Psychocybernetics, written by Dr. Maxwell Maltz.

Dr. Maltz, who was a plastic surgeon before going into psychology, writes:

“It usually requires a minimum of about 21 days to effect any perceptible change in a mental image. Following plastic surgery it takes about 21 days for the average patient to get used to his new face.”

One way or another, this finding on the results of plastic surgery was applied to habit formation, and the anecdote spread wildly.

UCL researchers decided to test this advice by doing a rigorous study of habit formation. What they found through their research was that the average time it took a participant to form a new habit was actually 66 days – quite a bit more than the oft-cited 21.

In addition, they found that there was a lot of variation in how strong habits became for each test subject; less complex habits like drinking water peaked in habit formation strength sooner than more complex habits like doing 50 sit-ups.

The UCL researchers reported all this and more in a fantastic article, which I highly recommend reading if you’re interested.

In summary: You’re going to have to do a lot of repetition before a specific behavior becomes a new habit. The more complex or difficult the behavior is, the harder it’ll be to form. And it probably ain’t gonna be a breezy 21-day process.

Using Conditional Logic to Build Habits

Alright, so now that we know the basics of habit formation – and why it’s often so difficult – let’s look at how conditional logic can lend a hand in the habit-building process.

The idea here is to use the trigger – the “if” portion of the conditional statement – to remind yourself to practice the habit (the “then” portion).

Applying this to the context-dependent repetition ideal, we’re basically building contexts that work well as triggers.

To make this work, you need to ensure that your trigger is something you already do every day.

In order to make myself drink more water, I chose a trigger that I already do all the time – going to the bathroom. Each time I went to the bathroom, I’d immediately fill my water bottle back up and drink the whole thing.

To make myself do more pull-ups, I put a pull-up bar in my door frame so that walking into my room could become the trigger. Each time I walked into my room, I’d stop and do five pull-ups.


Notice that you’ll sometimes have to do some legwork to make your trigger suit the habit you’re trying to build. Without the pull-up bar being in my door frame, walking into my room isn’t a very good trigger to do pull-ups. The means to practice the habit need to be built right into your trigger.

Let’s take an example that’s given me more trouble than usual: getting up early in the morning.

I love to be up early; on any given day, I’d rather get my start at 6 AM rather than 10 AM.

However, actually getting out of bed is… well… really freaking hard. Sleepy Thomas does not have the same values as Normal Thomas.

Now, if I have a reason to get out of bed early – a meeting or a prior commitment to someone – then I can easily get up early. This is why I’ll often volunteer to pick my friend up from his night shift at 6:30 AM.

Without a good reason, though, getting up is hard. So it’s time to break out the conditional logic.

Initially, I tried building the same trigger that everyone uses.

If my alarm goes off, then I will get up.

Yeeeaaahhh… nice try. In practice, the snooze button is hit 30 times. So I tried building a stronger trigger by placing my alarm far away from my loft bed:

If my alarm goes off, then I will get out of bed and go turn it off.

At this point, the trigger seems pretty strong. If I don’t get out of bed, it’s going to continue to squak at me.

Well, it turns out that my sleepy self will go to extreme lengths to keep sleeping – including getting out of bed, hitting snooze, and climbing back up. Again and again.

Alright, let’s try something else. Rewrite the trigger:

If my alarm goes off, then I will do 20 push-ups and turn it off.

In addition, I make one small tweak to the trigger. I put my alarm clock under the small table in my room.

Since I have climb out of bed and then get on my hands and knees to reach the clock anyway, doing the push-ups is easy enough. And after doing them, the exercise has woken me up enough to not hit snooze. Success!

While we’re on the subject, my other method for waking up early – which has a 100% success rate – is setting up a system that will punish me if I don’t get up on time.

The important part I’m trying to illustrate here is that you might need to get imaginitive when creating your triggers.

Hop to It, Soldier!


Sometimes I wish I had a drill instructor around to make me practice all the habits I want to build. Maybe you feel the same – after all, we’re both probably familiar with what freedom can do to our productivity.

For most things, though, we simply don’t have anyone telling us what to do. That’s why techniques like this one are so useful; they help us lessen the burden on our willpower reserves.

However, this technique won’t help you if you don’t use it. 

So, now that you’ve read the article, it’s time to start building some habits! Take a few minutes and think of a habit you want to form. In what context would you perform that action?

Once you know the context, think about how you can turn it into a trigger that’ll automatically remind you to perform the task. I’ve given you a few examples in this article; now it’s time to you to get creative.

If you think up a good one, leave a comment and tell me about it! You might just help out someone else who wants to do the same thing.

photo: drill instructor

Thomas Frank is the geek behind College Info Geek. After paying off $14K in student loans before graduating, landing jobs and internships, starting a successful business, and travelling the globe, he's now on a mission to help you build a remarkable college experience as well. Get the Newsletter | Twitter | Instagram

Hey there! Please note that some links in the article may be referral links, meaning that if you buy something through them, I'll earn a commission (at no extra cost to you). This helps to support CIG, but please don't buy anything unless you truly believe it'll benefit you! You can learn more here. Thank you :)

Want to Earn Better Grades?

Did you find this article useful?

Over 150,000 awesome students are learning how to dominate their classes, get more done, and land the jobs they want - and you should too.

Join in, and I'll also send you a free copy of my book on earning better grades!

Leave a Reply

21 Comments on "Building Concrete Productive Habits Through Conditional “If-Then” Logic"

newest oldest
Notify of
Sami Tahar Loucif

the whole strair climbing blue flower Christopher Nolan reference was the icing on the cake of this brilliant article !!! Thanks dude, not only did I learn, I actually lauphed too ^^


Thomas, you have a huge fan from South Africa! Can you please advise me on how to overcome the “I have done enough” paradigm, after just starting to get where you want to be (never actually finishing)? Rewarding yourself because you have started, by stopping?! Lol sounds like the ultimate guide for failure, I know.


Charles Duhigg also mentions something like this in his book ‘The Power of Habit’. His system also has a Routine part and a Reward part . Are that parts going to get posts in Future?


I love these ideas. This makes a lot of sense. Thank you very much for writing. I have been trying to build a habit of practicing my violin. Do you have any suggestions on how to build a trigger for this? I can’t think of how to make something relate to this.


I’m new to this technique so am looking forward to trying it out. Here are my suggestions.
First of all decide what time of day you want to practise.
Then think of something that you always do at that time. Something that you use or put away.
Either keep your violin or sheet music in that place, maybe even on top of the thing that you need to use: keep your sheet music on top of your laptop, in a bag hanging off your wardrobe door handle, on top of your phone charger…

Ludvig Sunström

Very lengthy and well-written article Thomas. I’m a huge fan of the “if-then” strategy myself, and you give some very good tips here.

Here are some helpful pointers if you want to embrance (intermittent) fasting:
— expect the hunger to come around 8-12+ hours after not eating. Drink a lot of water, possibly with L-glutamine in it. Drink coffee/tea if it’s early in the morning. Do this for 1-2 weeks and your body’s hormonal levels will eventually shift as you get used to fasting.


David Ramos

Great article, every post in your blog give me motivation dude.
Best wishes from Colombia.


Tom, I forgot how funny of a writer you were. The monk montage was an excellent intro and I actually LOLed when you compared Sleepy Thomas to Normal Thomas.

I used to create obstacles for myself to get up to my alarm instead of snoozing. I used to use an app that would force me to solve a math problem in order to turn off an alarm, which helped me two ways: waking me up and helping me with my basic math skills. I’m gonna have to get creative with this conditional habit formation you’re proposing. It would certainly get me back on track with my goal to journal everyday!

Benjamin Kasavan

I actually have a question: I’m all pumped to do this… but when I think of it, I don’t really have any habits I care to make. Pull ups would be one… but I’m cheap and like closing my door so a pullup bar in the door isn’t an option, I already made it a habit of drinking a lot… I don’t care about eating healthy – I already eat fairly healthily, and bah…
So, what habits would you recommend? (O, and I also auto-wakeup and can’t fall asleep after 7-8 hours of sleep, and find laying in bed annoying… so the wakeup thing isn’t for me.)
A list of good to have habits might be usefull…


Seriously one of your best articles, Thomas. Simple, yet detailed. I especially loved the story at the beginning.

Heard of TinyHabits?

Sanam (A Chic Lifestyle)

I’ve heard about this context dependant technique before and recently used it to create the habit of studying consistently after school.

So I now go to my schools study room after schools out, and just get out my stuff and work until 6pm.

It’s SO much easier to work there than at home, where I’m easily distracted and therefore can’t keep the consistency of building a new habit.

This is a really well explained post Tom, great tips! 🙂

Benjamin Kasavan

I agree about the change of context. (However, I find it impossible to work in the presence of people I know, thus that option doesn’t work for me.)
I tend to physically switch to my desktop computer if I need it, or to my desk if I have to work.
Sure, the change is 5ft, or even just 10in, but it is still effective.

// Read This Next

7 Essential Tips For Surviving Freshman Year (Ep. 12)

Want more? Join over 150,000 students and grab my free book on earning better grades  →