Armed with the ability to have and use variables, and to do mathematical computations, we can now evaluate
any mathematical expression that might come along. We'll do this by assigning the result of
an expression to a new variable, then displaying the value of the variable to the screen.
Move the mouse over a dotted box for more information.
Take a look at this default code (refresh your browser page if needed). It sets the variable x to 5, then computes y based
on some formula that contains x. The convenience here is that suppose you needed to find y for another value of x. You would
just change the x=5 to something else, perhaps x=105, then run your code again.
Now you try. Try defining some variables, then using the variables in a larger mathematical expression.
Type your code here:
See your results here:
Share your code
Show a friend, family member, or teacher what you've done!