You always have to balance between expressiveness and robustness/reliability.
Your short code snippet about the for loop is nice, but once your function start to balloon into more lines, having more and more state variables makes your code harder to read/maintain and much more prone to errors.
On the other hand writing functional code, just to save yourself from having a proper conditional if, and a state, because that implies it, is not always worth it in terms of maintainability of your code.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You always have to balance between expressiveness and robustness/reliability.
Your short code snippet about the for loop is nice, but once your function start to balloon into more lines, having more and more state variables makes your code harder to read/maintain and much more prone to errors.
On the other hand writing functional code, just to save yourself from having a proper conditional
if
, and a state, because that implies it, is not always worth it in terms of maintainability of your code.