1.2. Variables

We will write our "Hello World" code here. In very short, variables are the places in your code where you can store program data while the program is running. They are called variables because you can change (vary) their values.

Now the Playground you created comes with a line of code:

var greeting = "Hello, playground"

It creates a new variable called greeting, and gives it the value "Hello, playground".

After you click on the play button, you'll see "Hello, playground" on the right side, which is the output area of the Playground.

Since greeting is a variable, we can always change it from the code, right? So let's change the value to something else like:

Now, you can see the new values showing on the output area!

Since greeting is a variable, we can change the values without creating a new variable for the new value!

Video

Last updated

Was this helpful?