Menu
Coddy logo textTech

Recap - Simple Logic

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

challenge icon

Challenge

Easy

Determine if a character can perform a special attack by combining multiple logical conditions. Create a variable called hasHighEnergy and assign it the value true. Create a variable called hasFullHealth and assign it the value false. Create a variable called hasSpecialPowerUp and assign it the value true. The character can perform the special attack if they have high energy AND either full health OR a special power-up. Use logical operators to create a variable called canPerformSpecialAttack that stores the result of this complex condition. Print the boolean result.

Try it yourself

-- Create the required variables
local hasHighEnergy = true
local hasFullHealth = false
local hasSpecialPowerUp = true

-- TODO: Write your code here to determine if the character can perform a special attack
-- Use logical operators to combine the conditions

-- Print the result
print(canPerformSpecialAttack)

All lessons in Fundamentals