Procedure
sloth_sleep/3
Sleep in the specified habitat for a number of hours.
Sloths need to sleep for a large number of hours each day because of their low metabolic
rate. Each time the sloth sleeps, their energy_level increases every hour by the
habitat’s Habitat/comfort_level.
By default, the sloth sleeps for 12 hours:
sloth_sleep(tired_sloth, lovely_habitat)
You can also specify a custom number of hours:
sloth_sleep(nearly_awake_sloth, lovely_habitat, 3)
Parameters
- habitat: The location for the sloth to sleep.
- number_of_hours: The number of hours for the sloth to sleep. Default 12 hours.
Returns
- The sloth’s energy level after sleeping.
Declaration
sloth_sleep :: proc(sloth: Sloth, habitat: Habitat, number_of_hours: int = 12) -> int