Now that you know a bit about variables, let’s code some ourselves!
We create or declare a variable by giving it a name and setting it equal to a value.
terrain = 'lake'
In the code editor, we’ve written out an example of a variable declaration. We’ve included one variable in the workspace, named
one, and it’s currently set to
Below variable ‘one’, declare a variable called
two. Set variable ‘two’ to equal
'rocks'. Remember to pay attention to details, like punctuation.
Next, create a variable
three and set it equal to
Run the code! How does the board game change?
Now, try replacing the values with other ones that you’ve seen in this lesson! Here’s the full list: