Hacker News new | ask | show | jobs
by itishappy 60 days ago
Right, you can attempt to take and potentially error, but if you already know that taking is possible you can skip the noise and simply return a result. Checking if your container is empty every time you remove an item is not free.