Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
In this video, you'll ask for the user's name.
Later, you'll use the code you just built to animate it.
To start, add an “ask” block above the repeat loop.
The default question in the "ask" block is "What is your name?"
Click the "ask" block.
A box pops up at the bottom of the stage where the user can type an answer.
The answer gets stored as a string in the answer variable.
In computer science, a string is a sequence of characters, such as letters, numbers, and
They can be single letters, words, or sentences.
Next, make your program display the name the user typed in.
To do this, your program will read each letter the user typed and change the sprite's costume
to the costume that matches each letter.
Right now, the program creates 5 letter sprite clones.
To make it display the number of letters in the user's name, click the operators menu,
and drag out a "length of" block.
The "length of" block counts the number of characters in its value box.
For example, type in the string "friend."
Click the block.
“Friend” has a length of 6.
Try another string.
The string "I like turtles!" has a length of 15, including the spaces and exclamation point.
Placing the “answer” block inside the “length of” block counts the number of
characters stored in the “Answer” variable.
Add the “answer” block to the "length of" block, then place these two blocks in
the repeat loop.
Click the flag to test, and type a name in the box.
This example enters the name "Quinn," which has 5 letters.
The "length of" block counts the number of letters in the user's answer and creates a
clone for each letter, so the program creates five clones.
That looks good, but it would be way cooler if the program animated the user's name.
You’ll work on that next.
Now, it's your turn.
Ask the user, "What is your name?"
Create a letter sprite clone for each letter in the user's name.