0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
No active XP Potion
Accept a Quest
Login to submit answers
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 much smaller than some other projects I've worked on.
Remember how we used the print()
instruction to print text to the console? We can also use it to print numbers. This prints the number 42
:
print(42)
Well, addition is one of the most common instructions in programming. This also prints the number 42
:
print(40 + 2)
It first calculates the sum inside the parentheses, and then prints the result.
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
Focus Editor
Alt+Shift+]
Login to Submit
Login to Run
Login to view solution