Skip to content

Please update your browser

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

6. Lowercase Function

Transcript

In this video, you'll enable the program to handle both uppercase and lowercase letters, and program a message for the user.

The starter project contains a function that converts uppercase letters to lowercase letters.

It uses a string of letters just like the answer variable.

The string is called “alphabet,” and it includes all lowercase letters.

The function selects a letter from the string, then it searches through the letters of the alphabet to find the letter that matches it.

It then sets another variable called "letter" to the lowercase version of the letter.

After you use this function, the variable "letter" will contain the lowercase version of the letter you passed in.

The function is defined in the starter project, but you still need to “call it” to convert any uppercase letters the user inputs to lowercase letters.

From the "More blocks" menu, add a "lowercase" block above the "switch costume" block.

Drag the "letter of" block out of the “switch costume” block into the "lowercase" block.

This will change each letter the user types into a lowercase letter, and stores the new letter in the “letter” variable.

Add the "letter" variable into the “switch costume” block.

Click the flag to test, and type in a name.

Great!

Next, choose a backdrop, and program a short message for the user.

You can choose one of the backdrops in the starter project, pick one from the Scratch library, or draw your own.

This example uses the summer backdrop from the starter project.

Next, add a character to your animation.

This example uses a blue Giga sprite from the backpack.

Use a sprite from the sprite library, an image you have, a character you drew in the paint editor, or a sprite from your own backpack.

Next, program the sprite to start talking after the letters begin to animate.

Click the letters sprite and add a "broadcast" block to the bottom of the code stack.

Name the message something unique, or use the default 'message1.' Program the character to receive that message and start talking.

Select the character sprite, and add a "when I receive" message.

Make sure the message you created is selected in the dropdown menu.

Add a "say" block.

Program the character to greet the user with the name they typed in.

Add a "join" block.

In the first blank, write something like "hey."

Add a space after your greeting.

In the other blank, add the "answer" block.

Click the flag, and type in a name to test.

Great!

The character says, "Hey Quinn!"

Add more "say" blocks to your message.

This example says, "You're awesome.

I hope you have the best day ever!"

Your message can say whatever you'd like.

Now, it’s your turn.

Use the lowercase function to convert any uppercase letters to lowercase letters.

Add a new sprite.

Broadcast a message after the animation to tell the new sprite to talk.

Program the sprite to greet the user with the name they input.

Add your own custom message.

arrow_backward Back
Next arrow_forward
Instructions
  1. Use the lowercase function to convert any uppercase letters to lowercase letters.
  2. Add a new sprite.
  3. Broadcast a message after the animation to tell the new sprite to talk.
  4. Program the sprite to greet the user with the name they input.
  5. Add your own custom message.