The “do” syntax is most useful when there is some cleanup that needs to be done after the operation. That is why using it with open()
works well, you don’t have to worry about closing the file, the standard library is responsible for that. Same with mktempdir()
where you want to delete the directory/file after you are done with it.
But of course not all functions in the base library have a need for the “do” syntax because there is no cleanup. So I guess when using a function, if it has some cleanup that you normally need to do, see if it can take a function as the first parameter and try to use that…if it makes sense.