🚀 Get 25% off access to all my premium courses - use discount code FUNCMAIN at checkout - view the pricing page now!

Interactive Lesson:

If Conditionals

We don’t always know the correct paths to go down ahead of time. In the heat of a battle, we need to be able to decide what spells to use and what actions to take.

We can use if logic to help us decide the spells to use and the paths to take thankfully:

if condition {
  return "returned if condition is true"
} else {
  return "returned in all other cases"
}

Task

When the HealingPrayer function is called, depending on the health passed in, it should return the appropriate healing spell to ensure our warriors can continue battling.

Additional Scrolls of wisdom