If else confusion

can someone write this?

I tried to use ternary operator, but I got lost :stuck_out_tongue:

this ofcourse itsnt going to work :smiley:


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:

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;
}
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;
}