Expand my Community achievements bar.

Your voice matters! Help shape the future of Adobe Journey Optimizer by sharing your feedback.
SOLVED

Odd or even

Avatar

Level 4

Hi team,

Can any one help me how to check array count is odd or even using helper function?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee

You can validate it on the following lines 

{% let arrayCount = count(profile.productsInCart) %}

{%#if arrayCount % 2 = 0 %} 
    even
{%else if arrayCount % 2 = 1 %} 
    odd
{%/if%}

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

You can validate it on the following lines 

{% let arrayCount = count(profile.productsInCart) %}

{%#if arrayCount % 2 = 0 %} 
    even
{%else if arrayCount % 2 = 1 %} 
    odd
{%/if%}