Energy was first introduced as a feature in the game sometime in 2008. Around March 2010, the original iteration of the feature was removed. It wasn't until June of the same year, that the modern-day energy function was introduced into the game.
Performing certain tasks, such as Jobs or clocking in at the Factory, requires energy. Clocking in at the factory reduces an entire energy bar to 0%, leaving it completely empty. Jobs reduce energy little by little but are more time-consuming than working at the factory. Energy refills on its own over time or can be refilled with energy drinks, which are typically found while performing jobs.
From 2008 to March 2010, performing most actions in YoVille (as YoWorld was called then), consumed energy. Walking around consumed energy, performing player actions also consumed energy. If energy was to get low, the avatar would begin to walk slower and slower, and became incapable of performing actions that required more energy than was available. With player actions, energy was similar to a currency.
To refill on energy, players could purchase food at places like Vinny's Diner, the Coffee Shop, and the Beach Store. This, of course, costed YoCoins. The avatar would begin to display a sandwich emoji chat bubble when they were low on energy, to show that the avatar was hungry.
Because the developers at the time found that the feedback they were receiving for this feature wasn't what they considered optimum, they swapped it out for the modern version still used in-game today.