# Else is unexpected

**URL:** <https://forum.kirupa.com/t/else-is-unexpected/331426>\
**Category:** flash\
**Created:** [July 30, 2013, 1:50pm UTC](https://forum.kirupa.com/t/else-is-unexpected/331426 "2013-07-30T13:50:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![haponing](https://avatars.discourse-cdn.com/v4/letter/h/7bcc69/32.png) [@haponing](https://forum.kirupa.com/u/haponing)\
**Post date:** [July 30, 2013, 1:50pm UTC](https://forum.kirupa.com/t/else-is-unexpected/331426/1 "2013-07-30T13:50:51Z")

</div>

Hi all, I’m making a quiz and wanted to highlight the correct answer with green and red if it’s wrong. But when i right the else statement it comes up else in unexpected.

```auto
 btnCheck.addEventListener(MouseEvent.CLICK, chkAnswer);

function chkAnswer(mevt:MouseEvent):void {
	//if (cdlCorrect[index] == cdlUserAnswers[index]) {
		cdlDone[index] = 1;
		var rectSize:uint = 300; 
		var correctRect:Shape = new Shape();
		var wrongRect:Shape = new Shape();
		correctRect.graphics.beginFill(0x00FF00, 0.5); 
		wrongRect.graphics.beginFill(0xFF0000, 0.5);

		//if(cdlUserAnswers[index] == 0) {		

 //}
        if(cdlCorrect[index] == "0") {
        correctRect.graphics.drawRect(45, 50, rectSize, 25);  
		
 }
        if(cdlCorrect[index] == "1") {
        correctRect.graphics.drawRect(45, 85, rectSize, 25);      
		
 }
 		if(cdlCorrect[index] == "2") {
        correctRect.graphics.drawRect(45, 120, rectSize, 25);      
		
 }
 		if(cdlCorrect[index] == "3") {
        correctRect.graphics.drawRect(45, 155, rectSize, 25);     
 }
		if (cdlCorrect[index] == cdlUserAnswers[index]) {
}
	    qHolder.addChild(correctRect);
			
	//}
	else {
		//correctRect.visible = false;
	//}
}
		
		if(cdlUserAnswers[index] == "0") {
        wrongRect.graphics.drawRect(45, 50, rectSize, 25); 
 }
        if(cdlUserAnswers[index] == "1") {
        wrongRect.graphics.drawRect(45, 85, rectSize, 25);      
		
}
        if(cdlUserAnswers[index] == "2") {
        wrongRect.graphics.drawRect(45, 120, rectSize, 25);      

}
        if(cdlUserAnswers[index] == "3") {
        wrongRect.graphics.drawRect(45, 155, rectSize, 25);
}		
		if (cdlCorrect[index] != cdlUserAnswers[index]) {
        
}
		qHolder.addChild(wrongRect); 

```
