When I'm using %
symbol it is showing the below error message:
Found punctuation symbol or operator '%' that isn't valid in Apex.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityWhen I'm using %
symbol it is showing the below error message:
Found punctuation symbol or operator '%' that isn't valid in Apex.
In most languages that use it, it represents the modulus operation.
In APEX, you use Math.Mod()
if (Math.Mod(x, 2) == 0) {
system.debug(x + ' is even');
}
APEX Expression Operators Reference shows that there is no definition of a %
operator.