Every code snippet in this article is functional. The only difference between your imperative and your functional examples is that the functional examples are convoluted.
isEven and isOdd are honestly such small tasks that it's hard to implement them in an imperative way. After all, imperative programming is about having a sequence of statements that have side effects, such as mutating variables.
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.
Every code snippet in this article is functional. The only difference between your imperative and your functional examples is that the functional examples are convoluted.
isEven and isOdd are honestly such small tasks that it's hard to implement them in an imperative way. After all, imperative programming is about having a sequence of statements that have side effects, such as mutating variables.