# If/Else If/Else Statement

**URL:** <https://forum.kirupa.com/t/if-else-if-else-statement/306500>\
**Category:** flash\
**Created:** [March 16, 2010, 6:42pm UTC](https://forum.kirupa.com/t/if-else-if-else-statement/306500 "2010-03-16T18:42:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antsuperhack](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Antsuperhack](https://forum.kirupa.com/u/Antsuperhack)\
**Post date:** [March 16, 2010, 6:42pm UTC](https://forum.kirupa.com/t/if-else-if-else-statement/306500/1 "2010-03-16T18:42:01Z")

</div>

Hey all,

Got a bit of a problem with the code I am writing for a small game.

It’s a horse racing game and what I am trying to achieve is if player 1 collides with the goal then the well done message shows. If player 2 collides with the goal then the oh dear message will show up. Sounds simple enough but I can’t figure out where i’ve gone wrong.

```auto
if ( player1.hitTestObject( goal ) ) {

    wellDone.visible = true; //Turns oh dear message visible.
    
    } else if ( player2.hitTestObject( goal ) ) {
        
    ohDear.visible = true; //Turns well done message visible.
    
    } else { 
    
    trace("neither are true");

    }

```
