Basics of Scratch Programming
Last Updated :
11 Apr, 2025
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.

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,
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.

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.

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.

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.

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.

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.
- First, you have to select a suitable backdrop for your project. Here I have used the "Beach Malibu" backdrop.
- Select the sprite you want to work with. Here I have used the "Avery walking" sprite.
- Follow the following script:

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:
Scratch program running demo
Similar Reads
Computer Fundamentals Tutorial This Computer Fundamentals Tutorial covers everything from basic to advanced concepts, including computer hardware, software, operating systems, peripherals, etc. Whether you're a beginner or an experienced professional, this tutorial will enhance your computer skills and take them to the next level
4 min read
Fundamental
Computer HardwareComputer hardware refers to the physical components of a computer that you can see and touch. These components work together to process input and deliver output based on user instructions. In this article, weâll explore the different types of computer hardware, their functions, and how they interact
10 min read
What is a Computer Software?Computer Software serves as the backbone of all digital devices and systems. It is an integral part of modern technology. Unlike hardware which comprises physical components, software is intangible and exists as a code written in programming language. This article focuses on discussing computer soft
8 min read
Central Processing Unit (CPU)The Central Processing Unit (CPU) is like the brain of a computer. Itâs the part that does most of the thinking, calculating, and decision-making to make your computer work. Whether youâre playing a game, typing a school assignment, or watching a video, the CPU is busy handling all the instructions
6 min read
Input DevicesInput devices are important parts of a computer that help us communicate with the system. These devices let us send data or commands to the computer, allowing it to process information and perform tasks. Simply put, an input device is any tool we use to give the computer instructions, whether it's t
11 min read
Output DevicesOutput devices are hardware that display or produce the results of a computer's processing. They convert digital data into formats we can see, hear, or touch. The output device may produce audio, video, printed paper or any other form of output. Output devices convert the computer data to human unde
9 min read
Memory
Computer MemoryMemory is the electronic storage space where a computer keeps the instructions and data it needs to access quickly. It's the place where information is stored for immediate use. Memory is an important component of a computer, as without it, the system wouldnât operate correctly. The computerâs opera
9 min read
What is a Storage Device? Definition, Types, ExamplesThe storage unit is a part of the computer system which is employed to store the information and instructions to be processed. A storage device is an integral part of the computer hardware which stores information/data to process the result of any computational work. Without a storage device, a comp
11 min read
Primary MemoryPrimary storage or memory is also known as the main memory, which is the part of the computer that stores current data, programs, and instructions. Primary storage is stored in the motherboard which results in the data from and to primary storage can be read and written at a very good pace.Need of P
4 min read
Secondary MemorySecondary memory, also known as secondary storage, refers to the storage devices and systems used to store data persistently, even when the computer is powered off. Unlike primary memory (RAM), which is fast and temporary, secondary memory is slower but offers much larger storage capacities. Some Ex
7 min read
Hard Disk Drive (HDD) Secondary MemoryPrimary memory, like RAM, is limited and volatile, losing data when power is off. Secondary memory solves this by providing large, permanent storage for data and programs.A hard disk drive (HDD) is a fixed storage device inside a computer that is used for long-term data storage. Unlike RAM, HDDs ret
11 min read
Application Software
MS Word Tutorial - Learn How to Use Microsoft Word (2025 Updated)Microsoft Word remains one of the most powerful word processing program in the world. First released in 1983, this word processing software has grown to serve approximately 750 million people every month. Also, MS Word occupies 4.1% of the market share for productivity software.With features like re
9 min read
MS Excel Tutorial - Learn Excel Online FreeExcel, one of the powerful spreadsheet programs for managing large datasets, performing calculations, and creating visualizations for data analysis. Developed and introduced by Microsoft in 1985, Excel is mostly used in analysis, data entry, accounting, and many more data-driven tasks.Now, if you ar
11 min read
What is a Web Browser and How does it Work?The web browser is an application software used to explore the World Wide Web (WWW). It acts as a platform that allows users to access information from the Internet by serving as an interface between the client (user) and the server. The browser sends requests to servers for web documents and servic
4 min read
What is a Excel SpreadsheetIf you search only about Spreadsheet then you will find it is a computer applicaion that save, display, and manipulate data in rows and columns. In the year 1978 first spreadsheet program is developed by Daniel Bricklin and Bob Frankston named as VisiCalc. Now, in the recent year Microsoft Excel is
12 min read
System Software
Programming Languages
C Programming Language TutorialC is a general-purpose mid-level programming language developed by Dennis M. Ritchie at Bell Laboratories in 1972. It was initially used for the development of UNIX operating system, but it later became popular for a wide range of applications. Today, C remains one of the top three most widely used
5 min read
Python Tutorial - Learn Python Programming LanguagePython is one of the most popular programming languages. Itâs simple to use, packed with features and supported by a wide range of libraries and frameworks. Its clean syntax makes it beginner-friendly. It'sA high-level language, used in web development, data science, automation, AI and more.Known fo
10 min read
Java TutorialJava is a high-level, object-oriented programming language used to build web apps, mobile applications, and enterprise software systems. It is known for its Write Once, Run Anywhere capability, which means code written in Java can run on any device that supports the Java Virtual Machine (JVM).Java s
10 min read
JavaScript TutorialJavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. It's an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side: On the client side, Jav
11 min read