Update Your Progress explainer

The aim of this puzzle: To add to and update the variable elevation, then print out the new value for elevation.
Review concepts: The achievement ‘Used Math Operators’ unlocks the ability to complete this puzzle.
Review puzzles: Try taking another a look at the puzzle ‘Simply More Math’ to see how to add to a variables value then print it out using print().
Sample code solution:
(Tap below to reveal)

Since this is part of the final topic of the fundamentals course and it is testing your knowledge, there is no sample solution code.

JavaScript Concepts: Calling Functions, Binary Expression (+)
Grasshopper Concepts: print()

Additional Code (hidden code that runs before the puzzle’s code):

var elevation = 100;

I’m putting in the correct code and nothing is happening.

I don’t get it either. I’ve done just what that stood, and I gets the right answer, but it still is wrong…?


Technically my attempt worked but it didn’t pass lol


Mh… what‘s wrong here? I don‘t get it…


@Midnitewolfy Looks like you did the same thing as Joseph! lol
The puzzle is looking to update the elevation variable and THEN print the new value as two separate lines.
Take a look at Momo’s screenshot to view the answer.

@hagr If you leave off the single quotes around your screenshot, the board will automatically put your image in your post rather than just the code. But I was able to view your screenshot in my post preview and looks like you’re having the same issue as Joseph and Midnite. The puzzle is looking for two separate lines: update the variable THEN print the new value. :slight_smile:

1 Like

Any thing wrong with this method?

Hey @Fuzzi,

Although this method prints out the values correctly, the value inside elevation hasn’t been updated.

This means, if you add a third line of code of print(elevation) at the end, it would print out 100, rather than 555. Since the aim of this puzzle is to add to the value elevation, using print(elevation + 455) doesn’t solve it.

H :slight_smile:

For those having problems this thread didn’t really help me so I had to figure it out and now I’m here to help so here you go:

First things first. It’s not simple math, it’s actually “Simply More Math” in the operators section.

Now with that said here’s the point of confusion.
If we refer to “Simply More Math” we’ll find that we had to write the equation and then print it. So:
var y = 10;
y = y + 7;

Gives us a print out of 17

Now if we apply this to our current problem with elevation:

elevation = elevation + 455

This is the code that’s hanging us up because we’re not realizing that we’re supposed to do the equation outside of the print codes, thereby hiding the calculation that is taking place. I hope this is helpful in explaining the issue.

EDIT: Hey so as an after thought… The reasoning of this, because i believe reasoning will help to show why it had to be done this way, is that the equation updates the code. This is crucial for later when we are doing more extensive coding. Essentially as @RetroJLO was pointing out, this is updating the variable “elevation” if for instance later we added another 300 to the elevation, you would want it to add to the already calculated total, not the initial 100. If it’s not done as this code shows that’s what would happen, so it’s important to understand this.


This was helpful! Thank you. This puzzle makes zero sense.

Hey @jmal,

Thanks for catching that — I’ve updated it now.

And thanks for adding such a detailed explanation!

H :slight_smile:

The ‘hidden code’ is something that one should be aware of and I don’t know how anyone could know that from the exercise? I could not figure out why it was not necessary to assign an initial value to “elevation”.

I can’t figure it out

Screenshot_20180529-071450that works

1 Like

Hmm I misunderstood the code and as far as I know this is wrong, but I got lesson complete… just wanted to inform about this.

I have tried many solutions but it doesn’t work this what I got

Hey there,

To update the elevation variable, we have to use the assignment operator = to change its value.

Writing elevation + 455 on a line by itself means that the computer will calculate the answer (555), but won’t do anything with it.

elevation = elevation + 455 will make the computer calculate the answer, and then assign that value back to elevation.

Try taking the elevation = elevation + 455 out of the print() function call, so it’s just on a line by itself. Then on the next line, you can call print(elevation) to print out the new value.

Hope this helps! Let me know if you have any questions.