Say Hello to Snap!

In this activity, you'll play greet the user in various languages and with fancy text.

Loading a Snap project

For each lab, we'll provide you with starter projects that you can save to your account.

  1. Open this Say Hi To Snap project.

Saying Hi

When you open the project, you'll see this single block in the "Scripts" area (the central space of the Snap! window):
say hello to () in ('English')

  1. Type a name in the blank slot, and click the block to see what happens. Did you see a bubble pop-up?
  2. Change the name, and click the block again.

Every Snap! program is made up of blocks like say hello that tell the computer what to do. This block says hello to someone in a specified language.

  1. Choose a different language from the dropdown menu that says "English," and click the block again. What changed about the bubble this time?

You just saw how changing the inputs to a block changed its output. Now let's introduce some terminology.

: Reporters and Inputs

Blocks Within Blocks

There are lots of blocks in Snap!, and you can even make your own. For this first project, most of the blocks are hidden, but you should see a fancy () block in the palette on the left.

  1. Drag the fancy block somewhere below the say hello block in the Scripts area.
  2. Type a name into the fancy block, and click it to see the output. Does it look… Ƒᵃ𝐍𝓬у?
  3. Snap! is called Snap! because you can snap blocks together. Drag that fancy block into the first input slot of the say hello block, replacing the name from before, and click the block to see the output.
  4. Tip: You can tell where the block you are dragging will drop when you let it go because the input slot where it will land will be marked with a white box. Click for a picture.
    image of Snap! 'Scripts' area with the 'fancy('Huan')' block being dropped into 'say hello to ('Huan') in ('Cantonese')'. There is a white box around the 'Huan' in the 'say hello to ('Huan') in ('Cantonese')' block showing where 'fancy('Huan')' will land.
  5. You should see a personalized greeting to a fancy version of the input name in the chosen language.
    say hello to (fancy('Huan') in ('Cantonese') reporting 'néih hóu ᕼย𝕒N'

That's the power of reporter blocks! You can use the output of one block as the input to another block, making a chain of computation.

Saving Your Project

  1. Make sure you are logged in to Snap! by checking that your name appears in the Snap! Cloud menu (cloud menu button), and logging in if necessary.
  2. Save your work Save this project to your Snap! account by choosing "Save" from the Snap! File menu (it looks like a piece of paper with a corner folded: File menu button).

Be sure to save your projects after an important change and, if you are using a shared computer, whenever you're done for the day.

In this activity, you learned to run a block by clicking it, you changed the inputs to the say hello and fancy blocks and observed their outputs, and you dragged the fancy block into the say hello block so that the output of one block could be used as the input of the other.