Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control Flow Statement

Status
Not open for further replies.

Elektryon

Technical User
Jul 10, 2004
12
US
There is a control flow statment that goes something like this:

condition ? return if true : return if false

I can't remember exactly how it goes, or the name for it, and any amount of seach engine searching is fruitless.

Thanks for the help.
 
Hm, is it? I didn't think I knew that much C.

Thanks
 
See iif:

IIf(expr, truepart, falsepart)



"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
its called ternary operator
x[blue] ? [/blue]t [blue]:[/blue] f
and u can find it in C/C++, C#, Java and JScript.

in VB/VB.net u can find
IIf(x, t, f)
function equivalent to this ternary operator. but there is somewhat difference in both.
 
The IIF(exp, truepart, falsepart) should be used carefully. Per the MSDN entry: both the truepart and the falsepart are evaluated, but only one is returned. See the MSDN about the warning.

Cassandra

 
Ah, thank you all for your valuable information.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top