# Define a function called GetLootForHealth
# It takes one parameter: current_health (a float number)
# It returns a string representing the loot item
GetLootForHealth(current_health : float) : string = |
# We use the parameter 'current_health' inside the function
# If health is low (below 50), you get a potion
if (current_health < 50.0): |
return "Shield_Potion"
# If health is medium (50-80), you get a bandage
else if (current_health <= 80.0): |
return "Bandage"
# If health is high, you get a weapon (because you don't need healing)
else: |
return "Assault_Rifle"
Verse Library
verse
01 Fragment
Uses conditional logic to determine loot rewards based on specific health threshold ranges.
verse-library/basics-of-writing-code-8-how-input-parameters-and-arguments-work-in-verse/01-fragment.verse