Introduction to Scratch: Your First Program
📋 Before You Start
To get the most from this chapter, you should be comfortable with: foundational concepts in computer science, basic problem-solving skills
Introduction to Scratch: Your First Program
You've learned about algorithms (step-by-step instructions) and binary (how computers understand data). Now it's time to actually tell a computer what to do. Welcome to programming!
But don't worry — you're not going to learn complicated languages like Python or C++ yet. You're going to start with something called Scratch, which is designed specifically for kids your age.
What is Scratch?
Scratch is a visual programming language. Instead of typing code like:
for i in range(5):
print("Hello")
You drag and click blocks that look like puzzle pieces. Scratch was created by MIT (Massachusetts Institute of Technology), one of the world's best universities.
The best part? Scratch is completely free. You can use it at scratch.mit.edu right now, online, no installation needed. If your school has a computer lab, Scratch is probably already installed.
How Scratch Works
Scratch has three main areas:
1. The Stage (right side): This is where your project happens. If you're making a game, this is where the game runs. If you're making an animation, the animation plays here.
2. The Sprite (what moves): A sprite is a character or object you can program. By default, Scratch gives you Scratchy the cat. You can change it to any character you want.
3. The Blocks (left side): These are the instructions you can give your sprite. Different categories of blocks are color-coded:
- Blue blocks (Motion): Move the sprite around, make it turn, change direction
- Purple blocks (Sound): Play sounds and music
- Red blocks (Events): Respond to clicks, key presses, or messages
- Orange blocks (Control): Make decisions, repeat actions, create loops
- Green blocks (Sensing): Detect collisions, check if something is touching something else
Your First Scratch Project: Make the Cat Walk
Let's create a simple program:
Goal: When you click the green flag, the cat moves across the screen.
Steps:
1. Go to scratch.mit.edu and click "Create"
2. You see the stage with the cat in the middle
3. Look for a red block that says "When [green flag] clicked"
4. Drag it onto the coding area on the right
5. Find a blue block that says "move 10 steps"
6. Drag it below the red block so they snap together
7. Click on the "10" and change it to "100"
8. Now click the green flag at the top of the stage
9. Watch the cat move!
Congratulations! You just wrote your first program. The cat moved 100 steps forward.
Adding a Loop: Repeat an Action
Now let's make it more interesting. What if the cat keeps walking forever?
1. Find an orange block that says "repeat 10"
2. Change the "10" to "forever"
3. Drag your "move 100 steps" block INSIDE the repeat block
4. Click the green flag again
5. Now the cat walks forever!
The code now looks like:
When [green flag] clicked
Forever
Move 100 steps
This is a LOOP — an instruction that repeats. Loops are super important in programming because you don't want to write the same instruction 1000 times. You write it once and tell the computer to repeat it.
Making the Cat Talk
Let's add dialogue. When the game starts, the cat says "Hello, friend!"
1. Find a purple block that says "say Hello!"
2. Drag it into your code, BEFORE the forever loop
3. Click on "Hello!" and type something else, like "Namaste!"
4. Run your code
Now your code is:
When [green flag] clicked
Say "Namaste!"
Forever
Move 100 steps
Making the Cat Turn
The cat walks in a straight line until it falls off the screen. Let's make it bounce back.
1. Find a green block that says "if touching [edge]"
2. Find a blue block that says "turn 180 degrees"
3. Put the turn block INSIDE the if-touching block
4. Put both of these INSIDE your forever loop
5. Run the code
Now your code is:
When [green flag] clicked
Say "Namaste!"
Forever
Move 100 steps
If touching [edge]
Turn 180 degrees
Now the cat walks back and forth forever!
Key Programming Concepts
Sequence: Doing things in order. The cat says "Namaste!" BEFORE it starts walking.
Loop: Repeating an action. The cat keeps walking forever (or a certain number of times).
Event: Something that triggers your code. In this case, clicking the green flag triggers the code.
Condition: A decision. "IF the cat is touching the edge, THEN turn around."
Ideas for Your Next Projects
Once you master the basics, try these:
1. Make a Simple Game: Create a game where the cat asks questions and you type answers. If you're right, the cat says "Correct!" and dances.
2. Make an Animation: Make multiple sprites (maybe add a dog sprite) and choreograph their movements.
3. Make a Quiz: Create a quiz about Indian history, science, or cricket. Keep score and show the final score at the end.
4. Make Music: Use the sound blocks to create a simple musical composition.
Why Learn Scratch First?
Scratch teaches you the fundamentals of programming without getting bogged down in syntax (exact spelling and punctuation). In "real" languages like Python, a single typo can break your entire program. In Scratch, you just drag blocks — no typos possible!
Once you understand sequences, loops, events, and conditions in Scratch, moving to "real" programming languages like Python is much easier. You already understand the logic; you're just learning a new way to write it down.
- Scratch — A visual programming language using blocks
- Sprite — A character or object you program to move and act
- Block — A piece of code that represents one instruction
- Sequence — Doing things in a specific order
- Loop — Repeating an action multiple times or forever
- Event — Something that triggers your code (like a click)
- Condition — An "if-then" decision in your code
- Algorithm — The overall plan of your program
📝 Key Takeaways
- ✅ This topic is fundamental to understanding how data and computation work
- ✅ Mastering these concepts opens doors to more advanced topics
- ✅ Practice and experimentation are key to deep understanding
Thinking Like a Computer Scientist
Before we dive into Introduction to Scratch: Your First Program, let me tell you something important. The most valuable skill in computer science is not memorising facts or typing fast. It is a way of THINKING. Computer scientists look at big, messy, confusing problems and break them down into small, simple steps. They find patterns. They test ideas. They are not afraid of making mistakes because every mistake teaches them something.
Right now, India has the second-largest number of internet users in the world — over 900 million people! And the companies building the apps and services these people use need millions more computer scientists. Many of them will be people your age, learning these concepts right now. This chapter on introduction to scratch: your first program is one more step on that journey.
Variables, Loops, and Making Decisions
Programs become powerful when they can remember things, repeat actions, and make choices. These three abilities — variables, loops, and conditionals — are the building blocks of ALL software:
# VARIABLES — the computer's memory
name = "Priya" # Stores text (string)
age = 12 # Stores a whole number (integer)
height = 4.8 # Stores a decimal (float)
likes_cricket = True # Stores True or False (boolean)
# CONDITIONALS — making decisions
if age >= 13:
print(f"{name} is a teenager!")
elif age >= 6:
print(f"{name} is in school!")
else:
print(f"{name} is very young!")
# LOOPS — repeating actions
print("
Counting to 10:")
for number in range(1, 11):
if number % 2 == 0:
print(f" {number} is EVEN")
else:
print(f" {number} is odd")
# REAL-WORLD EXAMPLE: Calculate your cricket batting average
scores = [45, 72, 0, 88, 23, 105, 34]
total = sum(scores)
innings = len(scores)
average = total / innings
print(f"
Batting average: {average:.1f} runs per innings")Notice how the code reads almost like English? That is Python's superpower — it was designed to be readable. The indentation (spacing) is not just for looks; Python REQUIRES it to know which code belongs inside an if block or a for loop. In India, Python is now taught from Class 6 in many CBSE schools as part of the NEP 2020 curriculum.
Did You Know?
🍕 Swiggy and Zomato process millions of orders per day. Every time you order food on Swiggy or Zomato, a complex system springs into action: your order is received, stored in a database, matched with a restaurant, tracked in real-time, and delivered. The engineering behind this would have seemed like science fiction 15 years ago. Two Indian apps, built by Indian engineers, feeding millions of Indians every day.
💳 India Stack — the world's most advanced digital infrastructure. Aadhaar (biometric ID for 1.4 billion people), UPI (instant digital payments), and ONDC (open network for e-commerce) are part of the India Stack. This is not Western technology adapted for India — this is Indian innovation that the world is trying to copy. The software engineers who built this started exactly where you are.
🎬 Netflix uses algorithms developed in India. Recommendation algorithms that suggest which movie you should watch next? Many Netflix engineers are based in Bangalore and Hyderabad. When you see "Recommended for You" on any streaming platform, there is a good chance an Indian engineer designed that algorithm.
📱 India is the world's largest developer of mobile apps. The most downloaded apps globally are built by Indian companies: WhatsApp (used by billions), Hike (messaging), and many others. Indian startup founders are launching companies in AI, biotech, and space technology. Your peers are already building the future.
The UPI Revolution as a CS Case Study
Before UPI, sending money meant NEFT forms, IFSC codes, 24-hour waits, and fees. UPI abstracted all that complexity behind a simple VPA (Virtual Payment Address like name@upi). This is the power of abstraction — hiding complex implementation behind a simple interface. Under the hood, UPI uses encryption (security), API calls (networking), database transactions (data management), and load balancing (distributed systems). Every CS concept you learn shows up somewhere in UPI's architecture.
How It Works — The Process Explained
Let us walk through the process of introduction to scratch: your first program in a way that shows how engineers think about problems:
Step 1: Define the Problem Clearly
Engineers always start here. What exactly needs to happen? What are the inputs? What should the output be? What could go wrong? In our case, with introduction to scratch: your first program, we need to understand: what data are we working with? What transformations need to happen? What are the constraints?
Step 2: Design the Approach
Before writing any code or building anything, engineers draw diagrams. They sketch out: how will data flow? What are the main stages? Where are the bottlenecks? This is like an architect drawing blueprints before constructing a building.
Step 3: Implement the Core Logic
Now we translate the design into actual code or systems. Each component handles its specific responsibility. For introduction to scratch: your first program, this might involve: data structures (how to organize information), algorithms (step-by-step procedures), and error handling (what happens if something goes wrong).
Step 4: Test and Verify
Engineers test their work obsessively. They try normal cases, edge cases, and intentionally broken cases. They measure performance: is it fast enough? Does it use too much memory? Are there bugs? This testing phase often takes as long as the implementation phase.
Step 5: Deploy and Monitor
Once tested, the system goes live. But engineers do not stop there. They monitor it 24/7: How many requests per second? Is there any lag? Are users happy? If problems appear, engineers can quickly fix them without stopping the entire system.
Building a Web Page Step by Step
Let us build a simple web page together. Think of HTML as the skeleton (structure), CSS as the skin and clothes (appearance), and JavaScript as the muscles (behaviour).
<!DOCTYPE html>
<html>
<head>
<title>My India Page</title>
<style>
body { font-family: Arial; background: #f0f8ff; }
.card { background: white; padding: 20px; border-radius: 10px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1); margin: 20px; }
h1 { color: #FF6600; }
button { background: #25D366; color: white; padding: 10px 20px;
border: none; border-radius: 5px; cursor: pointer; }
</style>
</head>
<body>
<div class="card">
<h1>Welcome to My Page!</h1>
<p id="message">Click the button to see magic</p>
<button onclick="changePage()">Click Me!</button>
</div>
<script>
function changePage() {
document.getElementById('message').textContent =
'Namaste! You just used JavaScript! 🎉';
}
</script>
</body>
</html>This single file demonstrates all three web technologies working together. The HTML creates the structure (heading, paragraph, button), the CSS inside the <style> tag makes it look beautiful (rounded cards, colours, shadows), and the JavaScript inside the <script> tag makes the button actually DO something. When you click the button, JavaScript finds the paragraph by its ID and changes its text. This is exactly how real websites like Flipkart and Zomato work — just with thousands more lines of code!
Real Story from India
Priya Orders Food Using UPI
Priya is a college student in Mumbai. It is 9 PM, she is hungry but broke until her salary arrives in 2 days. She opens Zomato, orders from her favorite restaurant, and pays using Google Pay (which uses UPI). The restaurant receives the order instantly. A delivery driver gets assigned. The restaurant cooks the food. Fifteen minutes later, it arrives at Priya's door still hot.
Behind this simple 15-minute experience is extraordinary engineering. The order was received by Zomato's servers, stored in databases, checked for inventory, forwarded to the restaurant's system, assigned to a driver using optimization algorithms, tracked in real-time, and processed through payment systems handling billions of rupees daily.
UPI (Unified Payments Interface) was built by NPCI (National Payments Corporation of India) — an organization founded by Indian banks. It handles more transactions per second than all Western payment systems combined. The software engineers who built UPI, Zomato, and Google Pay started where you are: learning computer science fundamentals.
India's startup ecosystem (Swiggy, Zomato, Flipkart, Razorpay) has created millions of jobs and changed how millions of Indians live. The engineers behind these companies earn ₹20-100+ LPA and solve problems affecting 1.4 billion people. This is the kind of impact computer science can have.
Inside the Tech Industry
Let me give you a glimpse of how introduction to scratch: your first program is applied in production systems at India's top tech companies. At Flipkart, during Big Billion Days, the system handles over 15,000 orders per SECOND. Every one of those orders involves inventory checks, payment processing, fraud detection, warehouse assignment, and delivery scheduling — all happening simultaneously in under 2 seconds. The engineering behind this is extraordinary.
At Razorpay, which processes payments for hundreds of thousands of businesses, the system must handle concurrent transactions while ensuring exactly-once processing (you cannot charge someone's card twice!). This requires distributed consensus algorithms, idempotency keys, and sophisticated error handling. When you see "Payment Successful" on your screen, dozens of systems have communicated, verified, and recorded the transaction in milliseconds.
Zomato's recommendation engine analyses your past orders, location, time of day, weather, and even what people similar to you are ordering to suggest restaurants. This involves machine learning models trained on billions of data points, real-time inference systems, and A/B testing frameworks that compare different recommendation strategies. The "For You" section on your Zomato app is the result of some seriously sophisticated computer science.
Even India's public infrastructure uses these concepts. IRCTC's Tatkal booking system handles millions of simultaneous users at 10 AM, requiring load balancing, queue management, and optimistic locking to prevent overbooking. The Delhi Metro's automated signalling system uses real-time algorithms to maintain safe distances between trains. Traffic management systems in cities like Bangalore and Pune use computer vision to analyse traffic density and optimise signal timings.
Quick Knowledge Check ✓
Challenge yourself with these questions:
Question 1: What are the main steps involved in introduction to scratch: your first program? Can you list them in order?
Answer: Check the "How It Works" section above. If you can recite the steps from memory, excellent!
Question 2: Why is introduction to scratch: your first program important in the context of Indian technology companies like Flipkart or UPI?
Answer: These companies rely on introduction to scratch: your first program to serve millions of users simultaneously and ensure reliability.
Question 3: If you were designing a system using introduction to scratch: your first program, what challenges would you need to solve?
Answer: Performance, reliability, maintainability, security — check these against what you learned in this chapter.
Key Vocabulary
Here are important terms from this chapter that you should know:
🔬 Experiment: Measure Algorithm Speed
Here is a practical experiment: write two Python programs — one that uses a list and one that uses a dictionary — to check if a word exists in a collection of 10,000 words. Time both programs. You will discover that the dictionary version is dramatically faster (O(1) vs O(n)). Now try it with 100,000 words, then 1,000,000. Watch how the difference grows exponentially. This single experiment will teach you more about data structures than reading a textbook chapter.
Connecting the Dots
Introduction to Scratch: Your First Program does not exist in isolation — it connects to everything else in computer science. The concepts you learned here will show up again and again: in web development, in AI, in app building, in cybersecurity. Computer science is like a giant jigsaw puzzle, and each chapter you complete adds another piece. Some day, you will step back and see the complete picture — and it will be beautiful.
India is producing the next generation of global tech leaders. Students from IITs, NITs, IIIT Hyderabad, and BITS Pilani are founding companies, leading engineering teams at Google and Microsoft, and solving problems that affect billions of people. Your journey through these chapters is the same journey they started on. Keep building, keep experimenting, and most importantly, keep enjoying the process.
Crafted for Class 4–6 • Programming • Aligned with NEP 2020 & CBSE Curriculum