This is a excerpt from a real project, just with variables renamed.
EDIT: * I’ve removed the issues from the original code so that this can be a real style vote, without sidetracking the readers.
Although, by fixing the code, I removed one of the things that I think the advantage of the second one is - it is much harder to make errors and dead code._
This was the usual imperative code that you’d find almost everywhere. And this is the alternative (functional) way of doing the same:
The second one is kinda what you’d do in maths:
What do you find more readable?