Lesson 1092 of 1169
How AI Helps Name Things in Your Code
Naming variables and functions is hard! AI helps you pick clear, good names.
Explorers · AI-Assisted Coding · ~4 min read
The big idea
In code, you have to name things — like 'score' or 'playerName.' AI is great at suggesting clear, helpful names.
Some examples
- Bad name: 'x'. Good name: 'numberOfApples'.
- AI can rename all 'thing1' and 'thing2' to clear names like 'cat' and 'dog'.
- Good names = code that reads like English.
- Lazy names = confusing code in 1 week.
Try it!
Imagine you're coding a pet game. Pick 5 things you'd need to name (like the pet's hunger). Ask AI for clear name ideas!
Why names in code matter so much
Imagine opening your backpack and finding three items labeled 'thing1', 'thing2', and 'thing3'. You'd have no idea what was inside without looking. Code is the same. When programmers name things vaguely — like calling a variable 'x' or 'data' — the code becomes a mystery even to the person who wrote it. Good names make code read almost like a sentence. Instead of 'x = x + 1', you could write 'score = score + 1'. Suddenly you know exactly what changed. AI is brilliant at suggesting names because it has read millions of programs and knows what kinds of names professional coders use. It follows naming conventions, like using camelCase (capitalizing each new word, like 'playerScore') or snake_case (putting underscores between words, like 'player_score'). When you ask AI to suggest names, it will usually give you a few options with different styles so you can pick the one that fits your project.
- Bad: x, thing1, data, stuff — these tell you nothing
- Good: score, playerName, numberOfApples — these explain themselves
- camelCase: playerScore, maxHealth (used in JavaScript)
- snake_case: player_score, max_health (used in Python)
- AI can rename all vague names in your code at once
Key terms in this lesson
End-of-lesson quiz
Check what stuck
8 questions · Score saves to your progress.
Lesson help
Questions are best handled with a grown-up here.
For this age range, Tendril keeps freeform AI chat paused until parent/guardian consent and child-safe moderation are fully verified. Use the quiz, notes, and related lessons below, or ask a parent, guardian, teacher, or librarian to work through the question with you.
Progress saved locally in this browser. Sign in to sync across devices.
Related lessons
Keep going
Builders · 30 min
Reading Existing Code With AI Help
Most of a developer's life is reading code someone else wrote. AI is astonishing at this. Here's how to get fast, honest explanations of unfamiliar code.
Builders · 30 min
Python Variables & Types — With an AI Explainer Beside You
Variables are named boxes for data. You'll write your first ten, then use AI to decode error messages and grow your intuition for types.
Builders · 30 min
Python Basics With an AI Pair
Variables, loops, and functions are the atoms of Python. Let an AI help you write them while you learn what each line actually does.
