# 'else' encountered without matching 'if' error

**URL:** https://forum.kirupa.com/t/else-encountered-without-matching-if-error/279384
**Category:** flash
**Created:** [January 14, 2009, 5:43am UTC](https://forum.kirupa.com/t/else-encountered-without-matching-if-error/279384 "2009-01-14T05:43:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![strawhat](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@strawhat](https://forum.kirupa.com/u/strawhat)
#### Post date: [January 14, 2009, 5:43am UTC](https://forum.kirupa.com/t/else-encountered-without-matching-if-error/279384/1 "2009-01-14T05:43:13Z")

</div>

checkTheMouse = function()  
{  
cursor\_mc.\_x = \_xmouse;  
cursor\_mc.\_y = \_ymouse;

```
if (_xmouse &lt; centerX-10) 
{ 
 panLeft(cursor_mc.gotoAndStop(2)); 
}

else if (_xmouse &gt; centerX+10 )  
{ 
 panRight(cursor_mc.gotoAndStop(2)); 
}

else if 
{
 dontPan();
}

```

}

**Error** Scene=Scene 1, layer=actions, frame=1:Line 27: ‘else’ encountered without matching ‘if’  
else if (\_xmouse \> centerX+10 )

anyone can help with this? =(
