How to write a code to get even numbers between 1 to 100?
Discussion posts and replies are publicly visible
reject( /* Drops number where fn!mod returns 1 */ fn!mod(_,2), /* Returns 0 for even numbers */ 1 + enumerate(100) /* Create list 1 ... 100 */ )
Best way I have ever seen, stefanmy personal method:
a!forEach( items: enumerate(100)+1, expression:{ if( mod(fv!item,2), {}, fv!item ) } )
As you know, using foreach to filter lists is not my prefered way.
yeah I do, for that I wrote "personal". ;)I like it regarding "readable code" for others. It became a way more important parameter in my coding style as I dealt with different coding styles in the same appian element and got in trouble to understand the different approaches/fixes of the same issue within a few code lines.