Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# using "?" if else statements to set value whats this called

Hey I just came across the following statement

return name != null ? name : "NA";

I am just wondering what this is called in .NET

does the ? stand for i.e. then do this... ?

like image 705
StevieB Avatar asked Dec 09 '22 01:12

StevieB


1 Answers

It's a "conditional operator" commonly known as the Ternary operator

It's found in many programming languages.

like image 105
sethcall Avatar answered Dec 11 '22 15:12

sethcall