Tip Calculator explainer


The aim of this puzzle: Add tip to your total and print out the final cost.

Walkthrough of the solution: The code view starts with two variables declared, total and tip. total is assigned a number, and tip is assigned 20% of total. To complete this puzzle, the total value needs to be updated to include the tip.

To start, tap below the tip declaration and above print() function. Then update the value of total by adding the line total = total + tip.

Sample code solution:
(Tap below to reveal)

var total = 80;
var tip = total * 0.2;
total = total + tip;
print("You should pay $" + total  + " for your dinner");

JavaScript Concepts: Calling Functions, Operators (+), Variable Declarations
Grasshopper Concepts: print()