Exam4Training

What is the recommended AMPscript logic to determine the background color of each table row within the loop?

A developer wants to create an HTML table where rows will alternate background colors between white and red. The developer does not know how many rows will be sent within each email, and decides to use a loop and assigns the RowCount() of the table rows to the variable @numerator .

What is the recommended AMPscript logic to determine the background color of each table row within the loop?
A . %%[IF DIVIDE(@numerator,2) =1 THEN SET @color = ‘Red’ ELSE SET @color = ‘White’ ENDIF]%%
B. %%[IF SUBSTRING(DIVIDE(@numerator,2),1) = 1 THEN SET @color = ‘Red’ ELSE SET @color = ‘White’ ENDIF]%%
C. %%[IF @numerator/2 = 1 THEN SET @color = ‘Red’ ELSE SET @color = ‘White’ ENDIF]%%
D. %%[IF MOD(@numerator,2) = 1 THEN SET @color = ‘Red’ ELSE SET @color = ‘White’ ENDIF]%%

Answer: A

Exit mobile version