Astronomy Hour of Code

Activity 2: Using Output


In the second activity, we are going to learn how to make the computer talk using a command called say. We use say exactly like we use the output command, except that it causes the computer to talk. Note that not all browsers support talking, so you need to be in Chrome or Safari. To make the computer say the words "Robotic telescope", we will type:

say "Robotic telescope"

in the online code window below and then select the green Run Program button below the editor on the right (second in the tab order).

Exploration Challenge (Optional):

In four lines of code, use separate say commands to make the computer say the names of the four planets closest to the sun.

Next Tutorial

In the next tutorial, we will discuss Astronomy Hour of Code | Activity 0, which describes Accessible astronomy themed Hour of Code.