Your first app
Build Coffee Counter, a one-screen app with a button that counts, step by step.
You'll build Coffee Counter: a screen that says how many coffees you've had today, and a button that adds one. On the way you'll meet the four things almost every app uses: a variable, views, an action and a formula.
#1. Make the app
- On Home, tap New App.
- In Name, replace "Untitled App" with Coffee Counter.
- In Description, type Counts the coffees I drink. Leave Category as Other.
- Tap Create.
The Builder opens on your new app. Its screen already has a big title, "My App", and a line of helper text. Both are ordinary Text views: you can change or delete them later.
#2. Add a variable to count with
A variable holds a piece of your app's data. This one holds the number of coffees.
- In the Library, open the Data & Logic tab: the last of the five icons at the top of the left panel.
- Tap Add variable, then Whole Number.
A variable named count appears, starting at 0. A whole number has no decimals, which is right for counting.
#3. Show the count
- Open the Components tab: the first icon at the top of the left panel.
- Under Text, tap Text. A Text appears under the helper text, already selected.
- In the Inspector's Style tab, find Content. Replace its words with
Coffees today: {count}.
The braces show a variable's value inside text, so the canvas now reads "Coffees today: 0".
#4. Add a button
- Under Controls, tap Button. Because the Text is selected, the button goes right below it, and now the button is selected.
- In the Inspector, replace the Title with Add a coffee.
#5. Make the button add one
An action is a list of steps that run when something happens. Here, a tap on the button changes count.
- With the button selected, open the Inspector's Actions tab. The card at the top says When · Tapped: the steps under it run each time someone taps the button.
- Tap Add action. Find Set Value, under Data, or type its name in Search actions, and tap it.
- Tap the Set Value step to open its settings.
- State is the variable to change. It's already count, your app's only variable. If it isn't, tap it and choose count.
- Beside To, tap ⚡︎ (Set from variable) and choose Formula….
- Type
count + 1. Under it, Right now: 1 shows what the formula works out to on the canvas, where count is 0. - Tap Done.
To now shows the formula. Read the whole step as: "When tapped, set count to count + 1."
#6. Try it
- Tap Preview in the toolbar. Your app opens on a device.
- Tap Add a coffee twice. The text changes to "Coffees today: 2".
- Tap Done editing to go back to the Builder.
That's a working app. Each time Preview opens, count starts again at 0. To keep the number after the app closes, have the variable remembered: see Variables.
#Where to go next
- Finish it: tap Finish to give it an icon and add it to My Apps. See Finish your app.
- Learn the ideas behind it: Key ideas explains screens, views, variables, actions and formulas.
- Find your way around: A tour of the editor, or A tour of the Builder in Tutorials, which shows you each part inside PadCode.
- Let the AI Agent build with you: The AI Agent.
- Go further with what you used:
- Text with values: more about
{braces}. - Formulas and the formula functions.
- Set Value, Triggers and all actions.
- Text and Button.
- Text with values: more about