# If else confusion

**URL:** <https://forum.kirupa.com/t/if-else-confusion/291420>\
**Category:** Uncategorized\
**Created:** [June 29, 2009, 3:50pm UTC](https://forum.kirupa.com/t/if-else-confusion/291420 "2009-06-29T15:50:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lope](https://avatars.discourse-cdn.com/v4/letter/l/43a26b/32.png) [@lope](https://forum.kirupa.com/u/lope)\
**Post date:** [June 29, 2009, 3:50pm UTC](https://forum.kirupa.com/t/if-else-confusion/291420/1 "2009-06-29T15:50:57Z")

</div>

can someone write this?

I tried to use ternary operator, but I got lost 😛

this ofcourse itsnt going to work 😃

```auto

var fit:Boolean;

if(
    if(!fit){
      (targetRatio > destinationRatio) {
    }else{
      (targetRatio < destinationRatio) {
    }
        mc.height = (stage.stageWidth / mc.width) * mc.height;
        MC.width = stage.stageWidth;
} else {
        mc.width = (stage.stageHeight / mc.height) * mc.width;
        mc.height = stage.stageHeight;
}

```

I basically want to get 2 in 1:

```php
if (targetRatio < destinationRatio) {//if(fit) use this line
    mc.height = (stage.stageWidth / mc.width) * mc.height;
    mc.width = stage.stageWidth;
} else {
    mc.width = (stage.stageHeight / mc.height) * mc.width;
    mc.height = stage.stageHeight;
}

```

```php
if (targetRatio > destinationRatio) {//else use this line
    mc.height = (stage.stageWidth / mc.width) * mc.height;
    mc.width = stage.stageWidth;
} else {
    mc.width = (stage.stageHeight / mc.height) * mc.width;
    mc.height = stage.stageHeight;
}

```
