Simpler Math explainer


#1

Aim of the puzzle: Use the ++ and -- operators to change the value of a variable.

Walk through of solution: On the first line, the x variable is defined with the value 5. The next line increments (adds 1 to) the x variable. You can see the results printed by the next line.

Now, tap on the x on the next line all by itself. Tap the -- button to decrement (subtract 1 from) the x variable. When you run the code now you will see that the value of x went back down by 1.

Sample code solution:
(Tap below to reveal)

let x = 5;
x++;
print('x is ' + x);
x--;
print('x is now ' + x);

Javascript Concepts: Variables (let), Increment (++), Decrement (--)

Grasshopper Concepts: print()


#4

I cannot add to a string inside a bracket . When I type ‘x is now’ I cannot add + x between the end of the string and the bracket.
Hope I have explained my problem so that it can be understood!


#5

OK, no need to reply. I fixed it by not doing this by myself, rather just reverting to the original and adding one operator, which I see now was the intention.