Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • CBSE
  • Class 10 Syllabus
  • Maths Notes Class 10
  • Science Notes Class 10
  • History Notes Class 10
  • Geography Notes Class 10
  • Political Science Notes Class 10
  • NCERT Soln. Class 10 Maths
  • RD Sharma Soln. Class 10
  • Math Formulas Class 10
Open In App
Next Article:
Variables in Scratch Programming
Next article icon

Basics of Scratch Programming

Last Updated : 11 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Scratch is a programming language. Programming language is meant that a means of communicating with the computer, so as to give some instructions for it to perform. Programming in Scratch is very easy, including animation and games. It is a very useful tool for young kids or creators to learn and implement coding logic. It was developed by MIT’s Media Lab and it is free and can be used online on its, website, or it can be downloaded to use offline. It is available for operating systems like Windows, iOS, ChromeOS, Android 6.0+, etc. In this article, we will discuss the basics of Scratch.

Script

In Scratch, a script is a set of instructions that are used to create a Scratch program. Or we can say that it is a stack of blocks that are connected with each other and perform the specified tasks. Scripts are used to interact with sprites and tell them what to do or say. We can create a script in the script area. Here, we drag the blocks from the block palette and assemble them to create scripts. 

Script

Sprite

There are objects and characters that could be added to a program to perform actions based on code written in scripts in a project using blocks, these objects and characters are known as Sprite. You can add a prebuilt sprite or create a new sprite as per your requirement. You can find the option to add the sprite in the right bottom corner, second menu from the right corner. There are many free sprites already available in the store, you can choose any of them or can paint a new sprite, or upload any other sprite. Below are some of the preloaded sprites from the scratch,

 Scratch-Sprite

Some Sprites of Scratch 

Tempo

If you want to attach any instrumental blocks or beats to your scratch project then you need to determine how fast your note has to play. Whether you want to play the same beat for 60 seconds you want to play 3-4 beats for some time period. This control of the speed of instrumental beats in Scratch is known as Tempo.

Tempo

Events

Events in Computer Science refer to the trigger, which makes anything happen when any button is clicked or any action has happened. In Scratch, events are represented by Yellow color blocks, which include when the flag is clicked, when the sprite is clicked, when the key is pressed, etc.

Events

Backdrops

When you program something in Scratch, you have full freedom to use and change the background, before or during the program. These background effects are known as Backdrops.

Backdrops

Coding Blocks

Coding blocks are some pre-defined or pre-written blocks of code that make writing statements of code very simple in Scratch. You can use any coding blocks by simply dragging and dropping as per your requirements. You may also create your custom block if you want. Below are a few of the coding blocks explained in brief. Besides, there are various other coding blocks available, and also you and create your blocks too. 

  • Motion: These are used to move a sprite back and forth or in any direction or rotate them.
  • Looks: These are used to change the look of the sprite or replace them with some other sprite of the same category.
  • Sounds: Tempo or Sounds are used to control the sound flow in the program.
  • Events: Events handle trigger calls.
  • Controls: Conditional operators and loops are all in this category.
  • Sensing: Sensing controls how to react whenever the mouse pointer hits the playground and/or touches the sprite or by the motion of the mouse.
  • Operators: These are for the control and flow of arithmetic operations in the program.
  • Variables: You can declare the variables, in your program using these blocks.
  • My Blocks: You can create your custom blocks from here. 

Coding-blocks

Loops 

Loops in Scratch or any programming language help you execute the same line of code with or without different values for ‘n’ a number of times. You can either set the number of times or set a condition to end the loop. Scratch supports the following loops:

  • repeat: This block is used to iterate the given set of instructions ‘n’ a number of times. Here, the value of n is a positive number.
  • forever: This block is used to execute the given set of instructions infinitely.
  • repeat until: This block is used to iterate the given set of instructions until the given condition is not satisfied. 

Loops

Conditions

Conditions in Scratch are implemented using Control blocks. You can use control blocks to check for a condition and based on if the condition is true or false, the required code/script can be executed. Two of the most popular control blocks are:

  • if-then: In this block, if the given condition is true the code/script present inside this block will execute. Otherwise, the code/script present inside this block will be ignored.
  • if-then-else: In this block, if the given condition is true the code/script present inside this block will execute. Otherwise, the code/script present inside the else block will execute.

Projects

Any creation in Scratch such as code for a game, story, or animation is termed as a project in Scratch. You can create a project by using the Scratch editor. Once a project has been created it can be shared with other Scratch programmers (called Scratchers). As of Sep, 22 there are over 100 million shared projects in Scratch. 

Any scratches can use the code of a shared project and create another project through it. This process is called “Remixing”. As part of the community guidelines, you should acknowledge the creator of the original project whenever you are remixing their code. 

Scratch Project Example

Below is the implementation of a simple program:

Here we have made a girl walk along the beachside. She will walk a few steps and then say “Hello”. Let’s see how we have implemented this.

  1. First, you have to select a suitable backdrop for your project. Here I have used the “Beach Malibu” backdrop.
  2. Select the sprite you want to work with. Here I have used the “Avery walking” sprite.
  3. Follow the following script:

Scratch-project-example

Working of Code

  • The first event is when the flag is clicked, it is for starting the program.
  • The second block of code makes the sprite located in the initial position that is x is -164 and y is -69.
  • Then we placed a loop to repeat moving by changing the costume 20 times.
  • After completing the loop the sprite will say hello for one second.

Output:

Output

Scratch program running demo 



Next Article
Variables in Scratch Programming
author
geeky01adarsh
Improve
Article Tags :
  • Class 10
  • School Learning
  • School Programming
  • Scratch-basics

Similar Reads

  • Introduction to Scratch Programming
    Scratch is an event-driven visual programming language developed by MIT. In Scratch, we can create our own interactive stories, games, and animations using building blocks. In this platform, we do not need to write code to perform operations, things are done just by drag and drop, just like visual b
    5 min read
  • Introduction to Scratch Programming
    Scratch is a block-based visual programming language that can be used to make interactive games and animations. It has a huge online community where you can share, discuss and view scratch programs. The objective behind the development of Scratch is to help children(mostly) to think creatively, work
    3 min read
  • Script in Scratch Programming
    Scratch is an event-driven programming tool developed by the Lifelong Kindergarten group at MIT in the media lab to create your own games, visual programs, interactive stories using building blocks. To create a program in Scratch we do not need to write code to perform operations. In Scratch, the op
    4 min read
  • What is Iteration in Scratch Programming?
    Scratch is a high-level visual programming language tool that interacts with users through diagrams and blocks that have the basics of a program inbuilt in it. Scratch is used to make interactive programs especially for kids using the block kind of interfaces so that they can easily learn languages
    7 min read
  • Variables in Scratch Programming
    Scratch is a high-level visual programming language tool that interacts with users through diagrams and blocks that have the basics of a program inbuilt in it. Scratch is used to make interactive programs especially for kids using the block kind of interfaces so that they can easily learn languages
    7 min read
  • What is Conditional Programming in Scratch?
    Scratch is a high-level visual programming language tool that interacts with users through diagrams and blocks that have the basics of a program inbuilt in it. Scratch is used to make interactive programs especially for kids using the block kind of interfaces so that they can easily learn languages
    5 min read
  • Ask(), Wait() and Answer() Block in Scratch Programming
    Scratch is a high level visual programming language tool that interacts with users through diagrams and blocks that have the basics of a program inbuilt in it. Scratch is used to make interactive programs especially for kids using the block kind of interfaces so that they can easily learn languages
    4 min read
  • School Programming
    This page is designed for beginners in programming language, especially school students. It has the following sections. Introduction to Programming LanguagesLearning a Programming LanguageProgramming Problems and SolutionsPractice ProblemsRecent School Coding ArticlesRecent School Coding Practice Pr
    7 min read
  • Variable in Programming
    In programming, we often need a named storage location to store the data or values. Using variables, we can store the data in our program and access it afterward. In this article, we will learn about variables in programming, their types, declarations, initialization, naming conventions, etc. Table
    11 min read
  • What is a Code in Programming?
    In programming, "code" refers to a set of instructions or commands written in a programming language that a computer can understand and execute. In this article, we will learn about the basics of Code, types of Codes and difference between Code, Program, Script, etc. Table of Content What is Code?Co
    10 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences