You need to sign in to do that
Don't have an account?
Nag22
Ternary operator is not working
Hi
I am working with ternary operator , but it always giving false value
string resName';
resName = (obj.order_number__c == 1) ?obj.Response : ' NA';
Here order number type is number
Response is Text
But above ternary expression always gives 'NA'.
I tried with native IF like
if(obj.order_number__c == 1)
resName = obj.Response;
else
resName = 'NA';
the above code is working fine, but it is not working by using ternary operator.
Anyone explain me the why it is not working.
I am working with ternary operator , but it always giving false value
string resName';
resName = (obj.order_number__c == 1) ?obj.Response : ' NA';
Here order number type is number
Response is Text
But above ternary expression always gives 'NA'.
I tried with native IF like
if(obj.order_number__c == 1)
resName = obj.Response;
else
resName = 'NA';
the above code is working fine, but it is not working by using ternary operator.
Anyone explain me the why it is not working.
if (obj.order_number__c == 1) { resName = obj.Response; } else { resName = 'NA' }