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 a computer can follow one after another. Programs can have a lot of instructions.

The Boot.dev backend has 99,747 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")

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

print(42)

More importantly, because they're numbers, we can do math with them! 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