Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

2. Code a Question


In the last step, you should have opened the starter project and signed in.

If you haven’t done this yet, pause this video and go back to the previous step.

In this video, you will use the "ask" and "answer" blocks to get information from a person to create a profile.

Watch this video to learn how to do it, then try it on your own.

The starter project contains the sprites and layout that you’ll use to create the profile page.

Its sections include title, profile picture, friends, shoutout/post, and profile information.

A user will type in his or her own information to create a personal profile page.

First, click on the "name" sprite to select it.

When a sprite is selected, any blocks you add to the scripts area will apply to that sprite.

Next, click on the sensing menu.

Use an "ask and wait" block to make the sprite ask a question and wait for the user to type in an answer.

When you click on the "ask and wait" block, a text box shows up at the bottom of the screen.

This is where you type in your answer.

This block automatically asks "what is your name?"

Test it by typing your name in the text box.

Nothing shows up.

To see your answer, click on the check box next to the "answer" block in the sensing menu.

A blue box appears that shows your answer!

Now the user can answer a question to begin personalizing the profile page.

From the event menu, add a "when this sprite clicked" block to the top of the "ask and wait" block to make the question and text box appear when the "name" sprite is clicked.

Try it out!

When you click the "name" sprite, it asks "what is your name?"

This example types in "Aaron," and the answer appears in the blue box on the screen.

Now, it’s your turn: Program the "name" sprite by clicking on it and dragging out an "ask and wait" block from the sensing menu.

Click the checkbox next to "answer" to see your answer on the screen.

Then, add a "when this sprite clicked" event to the top of the code stack.

In the next video, you will use the "answer" block to set variables on the profile page.

If you need help, put a sticky note on your monitor to get the attention of a Guru.

Once you’ve completed this step, return to this tab, and click the green "next" arrow to move on to the next video.

arrow_backward Back
Next arrow_forward
  1. Make a sprite ask a question and wait for a response.
  2. Make the sprite ask a question when it's clicked.