Before they start coding something, most programmers begin by creating a data flow diagram to know exactly how each piece of code is supposed to work (how it should behave). If the behavior of the application is not complicated, you do not have to sketch it (although it is a good habit, even with simple things), but with more complicated behavior, it is hard to properly code such flow.
Sooner or later every programmer encounters the problem of synchronous execution of certain actions. For example: get user information from the API, parse server response, save data to the database, update the view, and many others. To make it even more, at some of these stages you still need to deal with error handling. The first thing that comes to mind and that seems to be the most reasonable and popular solution is using blocks. What could such code look like?