The aim of this puzzle: To multiply and divide the variable x
.
Walkthrough of the solution: This puzzle demonstrates how the multiplication (*
) and the division (/
) operators can be used to update a variable’s value. In the initial code the number 1 is being multiplied to x
, and then divided against x
. To solve this puzzle you’ll need to change 1 to be a number higher than that (i.e. 2, or 3, or 4, etc).
Sample code solution:
(Tap below to reveal)
var x = 10;
x = x * 5;
print(x);
x = x / 10;
print(x);
JavaScript Concepts: Binary Expression (=, *, /), Calling Functions, Identifiers, Variable Declaration
Grasshopper Concepts: print()