Menu
Coddy logo textTech

Recap - Simple Calculations

Part of the Fundamentals section of Coddy's Lua journey — lesson 17 of 90.

challenge icon

Challenge

Easy

Calculate the total damage from two different attacks and create a battle log message. You'll need to perform arithmetic calculations and then use string concatenation to format the results into a descriptive message.

Create the following variables:

  • fireAttack with the value 32
  • iceAttack with the value 28

Calculate the total damage by adding these two attack values together and store the result in a variable called totalDamage. Then create a battle log message by concatenating the string "Battle Report: " with totalDamage and the string " damage dealt!". Store this complete message in a variable called battleLog and print it.

Try it yourself

-- Create the attack variables
-- TODO: Write your code here

-- Print the battle log
print(battleLog)

All lessons in Fundamentals