Conditional Operator.

The syntax in Flex for conditional operator is same as that of the other technologies like c,java,.., for newbies the syntax is here.

Syntax:

Condition?(condition=true)statement:condition=false)statement.

Or

Condition?true satement:false statement.

It is nothing but a if.. else.. block in one single line.

Example in Flex:

Private function conopeExample():void

{

txtname.text=4>1?”Kumar”:”gandhi”;

}

<mx:TextInput id=”txtname” />

<mx:Button id=”btn” click=” conopeExample” />

The conditional operator is so simple that we programmers ignore that , or not interested in that. But it’s so simple that a good programmer will use to reduce the lines of code in the Application. Finally it’s synonym of our if .. else .. statements.

Enjoy the Post.

Advertisements

2 Responses to Conditional Operator.

  1. Ram says:

    HI Kumar..

    This is Ram…I am a flex Developer..U r doing an excellent job.. I have read ur post abt conditions.. I would like to write strong conditions and i wanna develop my coding knowledge too. I am expecting suggestions from U…
    Thanks & Regards
    Ram…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: