Ask(), Wait() and Answer() Block in Scratch Programming
Last Updated :
07 Aug, 2021
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 and it is free to use. In scratch, ask() and wait, the wait blocks are the block that senses the input and shows the output as per the input typed (i.e., the answer block).
ask() and wait block
The ask() and wait block is sensing and a stack block. It is a single block that first asks the question to the user and then waits for the input from the user. Or in other words, in ask() and wait block, the ask() block makes any sprite (actor of the scene) to display questions. The programmer can change the question to whatever they wish to ask the user. Simultaneously, an input field appears on the bottom of the screen where the user can type the input or answer the question and the answer/input is stored in the answer block. The answer block is always updated to the recent input. The wait block is to wait for the input of the user. If the question is asked by the sprite then the question will display in the bubble and if the question is asked by the stage or hidden sprite, then the question will display above the input block. You can find ask() and wait block in the sensing block.

Let us understand the working of the wait block with the help of a simple project. In this project we make a sprite asking the name of the user.
Procedure:
Step 1: Go to the costumes section and choose any sprite of your choice.
Step 2: Click on event block and choose 1st control block denoting the start of the program(drag it to center).
Step 3: Go to sensing block, and drag the ask() and wait block below the above step.
Step 4: Now, run the program.

Below is the implementation of the procedure:

answer block
It is a sensing and reporting block. The main purpose of the answer block is to store the answer(that was typed by the user in the input field) and, if needed, it can also display it on the screen. The answer block consists of the most recent input typed by the user and erases any previous inputs typed by the user. You can find the answer block in the sensing block.

Let us understand the working of the wait block with the help of a simple project. In this project we make a sprite ask the user how much degree the sprite must turn and then turn the sprite to that much degree.
Procedure
Step 1: Click on event block and choose 1st control block denoting start of the program(drag it to center).
Step 2: Go to sensing block, and drag the ask and wait block below the above step, change the question from “whats your name” to “how much degree the cat must move?”
Step 3: Go to motion block and select “turn O degree”
Step 4: Go to sensing block, drag the answer block and place it inside O of turn degree block
Step 5: Now run the program

Below is the implementation of the procedure:

wait block
It is a control and stack block. As the name suggests, this block is used to wait for n number of seconds, where n is any integer. It is the most commonly used block and is generally used when a sprite must wait for another action or is used in the time-critical programs. You can find a wait block in the control block.

Let us understand the working of the wait block with the help of a simple project. In this project we make a sprite say “hello” after 2 seconds of the start of the program
Procedure
Step 1: Click on event block and choose 1st control block denoting the start of the program(drag it to center)
Step 2: Go to control block and drag wait for 2 second below the above step
Step 3: Go to looks block and drag the “say hello” block below the wait block
Step 4: Now run the program

Below is the implementation of the procedure:

Similar Reads
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
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
What is a Block in Programming?
In programming, a block is a set of statements that are grouped and treated as a single unit. Blocks are used to define the scope of variables, control the flow of execution in conditional statements and loops, and encapsulate code in functions, methods, or classes. Table of Content What is a Block
6 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
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
Basics of Scratch Programming
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 im
6 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
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
Iteration Statements in Programming
Iteration statements, commonly known as loops, are statements in programming used to execute part of code repeatedly based on condition or set of conditions. These constructs are important for performing repetitive tasks efficiently. In this article, we will discuss various types of iteration statem
5 min read
Do-While loop in Programming
Do-while loop is a control flow statement found in many programming languages. It is similar to the while loop, but with one key difference: the condition is evaluated after the execution of the loop's body, ensuring that the loop's body is executed at least once. In this article, we will learn abou
10 min read