Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

A chatbot is a computer program that reads what a person types and sends back a helpful or friendly answer. In Scratch, you can build a simple chatbot with colorful blocks, sprites, speech bubbles, and a few rules. This project matters because it teaches the basic idea behind many AI tools: a program can take input, check it, and choose a response.

It is also a fun school project because you can design the bot's personality, look, and conversation style.

Key Facts

  • A simple chatbot follows the pattern input -> check -> response.
  • The Scratch ask block asks a question and saves the user's typed reply in answer.
  • A variable can store information, such as userName = answer.
  • An if then block runs code only when its condition is true.
  • A basic response rule can be written as if answer = "hello" then say "Hi there!".
  • Use repeat or forever to keep the chatbot conversation going.

Vocabulary

Chatbot
A chatbot is a program that answers a user's typed or spoken messages.
Sprite
A sprite is a character or object in Scratch that can be programmed with code blocks.
Input
Input is information a user gives to a program, such as typing an answer.
Variable
A variable is a named place to store information that a program can use later.
Condition
A condition is a true-or-false test used to decide which code should run.

Common Mistakes to Avoid

  • Forgetting to use the answer value after an ask block. The chatbot cannot respond to what the user typed unless the code checks answer or stores it in a variable.
  • Putting all replies in one long say block. This is wrong because the bot will always say the same thing instead of choosing a response based on the user's message.
  • Checking for only one exact spelling, such as "Hi" but not "hi". Scratch text comparisons must match, so the bot may miss a correct greeting if capitalization or spelling is different.
  • Not adding a repeat or forever loop for the conversation. Without a loop, the chatbot may ask one question and stop instead of continuing the chat.

Practice Questions

  1. 1 A Scratch bot asks, "What is your name?" and the user types Maya. Write the variable assignment that stores the reply in a variable called userName.
  2. 2 A chatbot has 3 possible responses: one for "hello", one for "help", and one for "bye". How many if then checks are needed if each response has its own condition?
  3. 3 Your chatbot keeps saying, "I do not understand" even when the user types hello. Explain two possible reasons this could happen and how you would fix them.