Teaching at home? The family edition is the same lesson, written for a parent and one to three kids.

Slides for the board (PowerPoint, 12 slides) Lesson PDF Google Slides: upload the PowerPoint file to Google Drive and open it with Google Slides.

App Maker: But If

Grades 6-8 · 45 minutes · Computer science, Technology

Students open a tap counter that already counts. It says Get to 20, and a You did it screen is waiting, but nothing happens at 20. They add one sentence to the Tap button: but if taps is at least 20, go to You did it. Now the same tap does nothing nineteen times and something new on the twentieth. Students trace what the app does on each tap in a table, try the three kinds of comparison, and find their rule in the code App Maker wrote.

At a glance

Essential question

How can the same tap do one thing most of the time and something different once?

Objectives

Students will be able to:

  • explain that a conditional is a check that makes a program do one of two things
  • build a rule that sends a button to a different screen when a number reaches a value
  • trace a program: say the value of a variable and the result of a check after each tap
  • compare is at least, is at most and is exactly, and choose the one a rule needs

Vocabulary

Conditional, Condition, True and false, Trace, Sequence

Standards

1B-AP-10, 2-AP-17

Time and materials

45 minutes, grades 6-8.

  • One computer or Chromebook per student
  • A projector
  • The worksheet and exit ticket, one copy each per student
  • The rubric, one copy per student if you grade the work

Prep

Make copies of the worksheet and exit ticket. Before class, open mytekdev.com/try/appmaker?lesson=but-if&ref=tpt-appmaker-3 once on a student computer: it opens on an orange app with a 0 and a Tap button, and checks that your school's filter allows the app. Run it yourself, about ten minutes: press Try it and tap past 20 (nothing happens); press Keep designing, click the Tap button, scroll to But if and click + Go somewhere else when a number gets there; make it read taps is at least 20, go to You did it; press Try it and tap to 20. Then click the Tap button and press See the code.

Assessment

  • Formative: the questions under What to look for, asked while students work, and the exit ticket (answer key included).
  • Summative: the worksheet, scored with the rubric.

Technology and privacy

Runs in any browser, Chromebooks included, with nothing to install. Students need no account and no email: the link works signed out, and nothing they do is stored on our server unless they choose to save. The app they build runs on a phone drawn on the page, so no phones are needed. Making a link for a real phone needs a free account and is not part of this lesson.

Lesson sequence

MinutesStageWhat you doWhat students do
0 to 5Warm-up
Hook
Show the title, essential question and Today I can slides (about 1 minute). Then the warm-up: the vending machine. What was it checking, and when?Answer the warm-up on the worksheet.
5 to 12Direct instruction (I do)
Model it
Project the app with the starter open. Press Try it and tap to 22 with the class counting. Nothing happens at 20. Press Keep designing, click the Tap button and read its panel aloud: when tapped, first add 1 to taps and play Pop; then go to Nowhere. Ask what is missing. Say that a check that makes a program do one of two things is called a conditional.

It's working when: But if is near the bottom of the button's panel, under Then go to. Scroll the panel if it is not in view.

Watch, and fill in the vocabulary on the worksheet.
12 to 22Guided practice (We do)
Add the rule
Students open the link or scan the QR code. A short guide walks them through adding the rule and tapping to 20. When apps reach You did it, ask: how many times did the app check?

Watch for: Students who leave the rule at its first value, or leave go to on the wrong screen, and say it does not work. Have them read the sentence in the panel aloud, word by word.

Follow the guide until the app reaches You did it.
22 to 38Independent practice (You do)
Trace it, then change it
Students fill in the trace table for the taps that take the number to 18, 19 and 20: the number after the step, whether the condition is true, and where the app goes. Then they change is at least to is exactly, and to is at most, and write what each does. Walk the room with the What to look for questions.

If they ask: "On the twentieth tap, does the app check before it adds 1, or after? How can you tell from what the screen shows?" Order

Fill in the trace table, then try the other two comparisons.
38 to 45Closure
Showcase and exit ticket
Show the Showcase slide. On the projector, click the Tap button and press See the code. Have a student read the line with 20 in it in plain words. Hand out the exit ticket.Answer the exit ticket.

Before you teach: a ten-minute walkthrough

Open mytekdev.com/try/appmaker?lesson=but-if&ref=tpt-appmaker-3. A short guide opens over the app. The phone shows a 0, the words Get to 20, a round Tap button, Back to zero and Wins: 0. Two cards sit under the phone: Tap! and You did it.

  1. Nothing at 20. Press Try it and tap past 20. The number keeps climbing. Press Keep designing.
  2. Read the button. Click the Tap button. The panel reads: When tapped, first: add 1 to taps, play Pop. Then go to: Nowhere. Under But if there is one line: + Go somewhere else when a number gets there.
  3. Add the rule. Click that line. A sentence appears with three things to set. Make it read: taps, is at least, 20, go to, You did it.
  4. Try it. Press Try it and tap to 20. On the twentieth tap the yellow You did it screen appears. Again sets taps to 0, adds 1 to wins and goes back.
  5. The code. Press Keep designing, click the Tap button and press See the code. The highlighted lines include: numbers.taps = numbers.taps + 1; and if (numbers.taps >= 20) return 's2';
  6. The trace. Tap 18: the number becomes 18, the condition is false, the app stays. Tap 19: 19, false, stays. Tap 20: 20, true, goes to You did it.
The moment that lands is the count of checks. Students think the app checks once, at 20. It checks every time, and the answer is no nineteen times.

Background for the teacher

A conditional is a check with two outcomes. The thing checked is a condition, and it is true or false. In App Maker a button's But if is its conditional: a number, a comparison (is at least, is at most, is exactly), a value, and a screen to go to when the condition is true. When it is false the button does what Then go to says.

Order matters. When a button is tapped its steps run first, from the top. Then the But if is checked. Then the button goes where it goes. So on the twentieth tap the app adds 1, making 20, and then asks whether taps is at least 20. If the check came first, the app would need twenty-one taps.

Is at least is the safe comparison for a counter. Is exactly works here too, because the number goes up by one and cannot skip 20. Change the step to add 3 and is exactly 20 never comes true: 18, then 21. Is at most 20 is true on the very first tap.

In the code, the rule is one line inside the button's function: if (numbers.taps >= 20) return 's2';. The name s2 is the app's own name for the second screen. The symbol >= means is at least.

App Maker is not a text programming language. Students build each rule as a sentence and the app writes the code, which they can read and cannot edit. It has no loops and no lists, a button holds one But if, and numbers are the only kind of data an app remembers. What it does have is the real thing in small: events, a sequence of steps, variables and a conditional, in an app that runs.

What to look for

Ask these while students work. A student who has understood the lesson can answer them without help:

The second question is the real test: a student who says the app adds first, then checks, and can point to the screen showing 20 as the proof, can trace a program.

Cross-curricular extensions

Vocabulary

ConditionalA check in a program that makes it do one of two things. App Maker calls it But if.
ConditionThe thing being checked, such as taps is at least 20. It is true or false.
True and falseThe two answers a condition can have.
TraceTo follow a program one step at a time and write down what each step does.
SequenceSteps that run in order. A button's steps run first, then its But if is checked.

Differentiation

English learners

  • Keep the vocabulary slide up, and point at the screen as you say each word: the cards under the phone and the sentences in the panel carry the meaning.
  • Pair each learner with a partner; the trace table is numbers, yes or no, and a screen name.
  • Accept "yes" and "no" for true and false.

Students with IEPs or 504 plans

  • Pair students for the trace table, one at the app and one recording.
  • Zoom the browser to 125%; the phone and the panel stay readable.
  • Lower the mark from 20 to 5 so the test takes five taps, where the IEP allows a modified assignment.

Students who need more support

  • A sentence starter: "The app adds 1, then checks whether ___. If it is true, it ___."
  • A check-in after the guide: every student has reached You did it before anyone starts the table.
  • Set the mark to 5 while testing, then put it back to 20.

Students ready for more

  • Change is at least to is at most, with 20. What happens on the first tap, and why?
  • Change it to is exactly 20, then press Back to zero at 19. Does the rule still work? When would is exactly go wrong?
  • On the You did it screen, the Again button adds 1 to wins. Add a But if to it that goes to a new screen at 3 wins.

Adapting for other grades

Younger students: In grades 4 and 5, do the guide together on the projector, with pairs sharing a computer, one clicking and one recording. Skip the third rubric row; total 8, and 6 meets the objectives. Use "the check" for conditional until students have built one, and set the mark to 5.

Older students: In grades 9 and 10, have students find the rule in See the code and name the parts: the function, the assignment, the comparison, the two returns. Ask what the function returns when the condition is false, and what the app does with that. Then ask what cannot be built here: a button holds one But if, and a condition compares one number with a fixed value.

App Maker: But If

Student worksheet

Name: ______________________________ Date: ______________

Open the app: scan the QR code, or go to mytekdev.com/try/appmaker?lesson=but-if

Essential question: How can the same tap do one thing most of the time and something different once?

Warm-up: A vending machine does nothing, then one more coin and the snack drops. What was it checking? ____________________

  1. Vocabulary. Conditional, condition, true and false, trace, sequence: write each in your own words.
  2. My rule. But if ____________ is ____________ ______, go to ____________.
  3. The trace table. For the taps that make the number 18, 19 and 20, write: the number after the step, whether the condition is true or false, and where the app goes.
  4. Change it. Try is exactly 20, then is at most 20. Write what each one does.

1. On the twentieth tap, does the app check before it adds 1 or after? How do you know?

2. Which comparison is the safest for this app: is at least, is exactly, or is at most? Why?

App Maker: But If

Exit ticket

Name: ______________________________

1. A conditional is (A) a number an app remembers (B) a check that makes a program do one of two things (C) a button that plays a sound

2. A button adds 1 to taps, then checks: but if taps is at least 5, go to Win. The number is 4. The button is tapped once. The app (A) stays, because 4 is less than 5 (B) goes to Win, because the add happens first and makes 5 (C) goes to Win twice

3. Write a But if sentence for a game that ends when lives reaches 0.

Answer key: exit ticket

QuestionAnswerWhy
1BThe condition is true or false, and the program does one thing or the other.
2BSteps run first, then the check. 4 plus 1 is 5, and 5 is at least 5.
3But if lives is at most 0, go to Game overAccept is exactly 0. Is at most is safer if a step can take away more than 1.

Rubric

Score each row from 1 to 4.

Name: ______________________________

Criteria4 Exceeds3 Meets2 Approaching1 Beginning
The ruleThe Tap button goes to You did it when taps reaches 20, shown in Try it.A rule was added that sends the button somewhere at some value.A rule was added and does not work.No rule.
The trace tableAll three taps: the number after the step, true or false, and where the app goes, all correct.Two taps correct.One tap correct.No table.
The comparisonsSays what is at least, is exactly and is at most each do here, and which one the app needs and why.Says what two of them do.Says what one does.No answer.

Total: ____ / 12. A score of 9 or more meets the objectives.

Standards

Control standards from CSTA 2017. Students add a conditional to an event and trace the sequence it runs in. App Maker has no loops, so the part of the standard about loops is not met.

FrameworkCodeGradesStandardHow the lesson meets it
CSTA 20171B-AP-103-5Create programs that include sequences, events, loops, and conditionals.Students build a program with an event (a tap), a sequence (the steps, then the check) and a conditional (But if). It has no loops.
CSTA 20172-AP-176-8Systematically test and refine programs using a range of test cases.Students test the rule at 18, 19 and 20, and with three comparisons, and record what the program does in each case.

Checked November 2026 against: CSTA 2017 K-12 standards progression chart.

Optional: save student work in a free class

The whole lesson runs at the link on the worksheet, with no accounts and no sign-up.

To keep students' work, and see it all in one place, make a free class. It takes about ten minutes, once, and covers every lesson in this series: mytekdev.com/tools/class-setup

Students in a class open mytekdev.com/tools/app-maker/lessons/but-if/start instead of the worksheet link. Each one gets their own copy of the starter, and the same link reopens it next time.