# Lesson goal: Evaluating mathematical expressions

Previous: Introduction | Home | Next: Calculate a tip

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.
variable=some-math-expression
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:

Show a friend, family member, or teacher what you've done!

Here is a share link to your code:

Does your code work? Want to run it on your iPhone?

Here's your code:

1. Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.

2. Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into this page

3. Then click the "Use on iPhone" button that you'll see.