Codesters FAQ is the official FAQ site for We will continue to update this blog with the most common questions we receive form teachers using Codesters.

How do I use the answer from an "ASK" block?

Using the sprite.ask block is one way to make your program interactive. The answer to sprite.ask is stored in a variable that can be used to display the answer or for comparision in an "if" statement.

  1. Click on the Actions toolkit
  2. Drag the Ask block into the editor

Looking at the example code below, the question asked is "Yes or no?"
The answer is stored in the variable called "choice"
The variable "choice" can then be used in the program. For example, it can be displayed using the sprite.say block.

choice = sprite.ask("Yes or no?")