Challenge
https://ampscript30.com/ampscript-challenge-day8/
To offer different discounts for different types of email addresses.
Solution
%%[
SET @email = Email
IF IndexOf(@email, '@gmail') > 0 OR IndexOf(@email, '@yahoo') > 0 OR IndexOf(@email, '@bing') > 0 OR IndexOf(@email, '@outlook') > 0 OR IndexOf(@email, '@msn.com') > 0 THEN
SET @discount = '$10'
ELSE
SET @discount = '$50'
ENDIF
]%%

Preview


Summary
IndexOf(variable to be assessed, character position to return) can be used to check if the variable contains certain characters. If the result is > 0, it means the variable contains those characters or else not. This way we can evaluate the contains logic in AMPscript.