I have a variable called full_name if full_name has a string length> 5 I would like to set nm to the first 4 characters of full_name, otherwise I would like to set nm for all characters of full_name.
var nm;
if (full_name.Length > 5)
{
nm = full_name.Substring(0, 4);
}
else
{
nm = full_name;
};
Am I completely confused "?" operator.
Can I use it for this?
Judyj source
share