Make an RPG
variables hold values, such as words or numbers.
In the example on the right we set hit_points to 12. Change the value to 15 and hit the run button.
You should see that it now says 15, not 12.
Before the print_me function, subtract 5 from hit points, like so:
If it worked, the run section should show 10 because 15 - 5 is 10.
Create another variable called damage and set it to 9. Next, in place of the 5, put damage.
If you did it right, the value below should be 6.
With variables you can do alot of math: addition, substraction, multiplication, division, absolute value, etc.
Get the Latest Tutorial Updates