Expand my Community achievements bar.

Join Adobe Journey Optimizer product experts for a live Ask Me Anything on October 15th at 8 AM PT about Expanding Your Mobile Reach with RCS & WhatsApp in AJO!
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 Advisor

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 Advisor

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%}