# Conditional operators "? :"

**URL:** <https://forum.kirupa.com/t/conditional-operators/221560>\
**Category:** flash\
**Created:** [April 5, 2007, 7:40am UTC](https://forum.kirupa.com/t/conditional-operators/221560 "2007-04-05T07:40:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flashkiddy](https://avatars.discourse-cdn.com/v4/letter/f/e19b73/32.png) [@Flashkiddy](https://forum.kirupa.com/u/Flashkiddy)\
**Post date:** [April 5, 2007, 7:40am UTC](https://forum.kirupa.com/t/conditional-operators/221560/1 "2007-04-05T07:40:41Z")

</div>

Hi there!  
I just ran into this little problem which is pretty superficial, but i simply dont know the answer to it.  
I want to replace several simple ‘if’ statements with conditional operators (? : ), but there is no ELSE statement.  
Right now i have a solution as defined below, but it’s pretty ugly…  
Is there a standard way to define this?

```auto
public function addDays(daysAdded:Number):DateDeluxe
    {
        /*
        if ( daysAdded == undefined )
        {
            daysAdded = 0;
            }
        */
        
        daysAdded = (daysAdded == undefined) ? 0:daysAdded;
etc...

```

I was thinking more about something like this:

```auto
daysAdded = (daysAdded == undefined) ? 0;

```

But it seems that this isnt valid code.

Greets and eternal infamy for those that can help me 😉  
Flashkiddy!
