(Redirected from Answer block)
- This article is about the block. For more information on the value this block reports, see Answer (value).
This block can be displayed as a Stage monitor.
As this block stores imputed text, it is very useful where a script has to refer to what has been inputted. For example, there are chatbots that let the Scratcher input their name. If the script needed to see the name, the Answer block could be used.
Some common uses for the Answer block:
- Storing information (such as in projects that require a name to be inputted)
ask [What's your name?] and wait set [name v] to (answer) say (join(join [Hi, ] (answer))[!])
- Retrieving information (such as when the name must be retrieved)
ask [What's your favorite color?] and wait say (join (answer) [ is my favorite color too!])
- When a setting has been imputed with the Ask () and Wait block, keeping the selecting setting somewhere
ask [Which level do you want to play?] and wait set [level v] to (answer) broadcast (join [start level] (level)) // This can actually be done in the Scratch editor. You can not, however, place reporters in "when I receive"
- When quizzing
ask [What is 30 + 9?] and wait if <(answer) = > then say [That is correct!] change [Score v] by (1) else say [That is incorrect] change [Score v] by (-1) end