We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

What Is “Code”?

Code is just a series of instructions for a computer to follow one after another. Programs can have a lot of instructions.

The Boot.dev backend has 46,119 lines of code as I write this... and it's smaller than many other programs!

Remember how we used the print() instruction to print text to the console, like this?

print("this is a string of text")

We can also use it to print numbers. Numbers, unlike plain text strings, are not surrounded in quotes. This prints the number 42:

print(42)

Adding Numbers

Addition is one of the most common instructions in programming. This also prints the number 42:

print(40 + 2)

First it calculates the sum inside the parentheses, then it prints the result.

Assignment

Simple addition is used all the time in game development. In Fantasy Quest, we want weapons to deal bonus damage when they're enchanted.

Our hero's sword deals 250 damage normally, but should deal an additional 75 damage when it's enchanted.

Calculate and print the result of 250 + 75