Im confused too.i get This result but nothing happens
AM i not the only one? Please, im making This solution and is not accepting. What i do?
Heather addressed why
var x = yellow won’t pass this puzzle.
Each time you use
var in your code you’re creating a new variable. Since the 1st line creates the
x variable, you don’t need to use
var x anymore in your code. You can change the value of
x by simply using
x = ....
var x = blue; - create a new variable called
x and store
blue inside of it
x = red - take the existing variable named
x, empty it out and then store
red inside of it.
Again, only use
var if you’re creating a new variable.
In general, you only want to use
var once, at the top.
Thanks for the answer. Learning code while is in english is a challange but im winning so far.
I changed x=red into x=yellow but i can’t go to the next exercise.
x variable is never being used. Instead of putting a color directly in
drawBox(), you can put the
x variable in the parentheses. As your code runs each line, it will use the current value of
Try replacing all the
Hi, I’ve written the code correctly but it just sticks there. I cannot move forward to next activity
Are you able to take a screenshot of your code and post it here? Myself and other users can help double check that there are no mistakes in your code. If there are no mistakes, then it may be a bug.
Are you able to take a screenshot of your code and post it here? Myself and
other users can help double check that there are no mistakes in your code.
If there are no mistakes, then it may be a bug.
@ruben_mestry Thanks for taking a screenshot! Now I see what’s going on. We’ve declared the variable twice rather than just updating the variable. While technically this code will draw the correct color boxes, the puzzle is looking for us to update the variable
x to be a new color. Since we’ve already used
var to declare
x as a variable earlier in the code, we can simply put
x = yellow; to update the variable. You only need to use
var again in your code if you wanted to declare a new variable.
var x = yellow; and replace it with
x = yellow; and the app should accept your answer.
Missing part of the lesson
The most common error is this puzzle is using
var x... twice.
var x will create a new variable called
x. Once it’s created, the value can be assigned using
x = ....
The 1st line of code should create
x and assign it to
var x = blue.
Later in the code, to change the value of
yellow, you only need to use
x = yellow, not
var x = yellow since the
x variable was already created in the 1st line.
Please help i am struct there
Make sure you’re only using
var x once.
var will create a new variable. Once it’s created, you can change the value just using the