> This is my thought experiment, which may or may not be valid. Feel free to comment and give your insights, but think twice before using any of my custom solutions in your code! Always prefer using language's functionality if possible.
Recently, I came across a scenario where I had to log a list of entries whenever that list was not empty. Basically, I was removing invalid data that I have received from outside and I wanted to warn about this in a case users would complain they are missing these entries.
Anyway, I had to do an equivalent of this several times in a row: