# Redundant code help

**URL:** <https://forum.kirupa.com/t/redundant-code-help/169773>\
**Category:** Uncategorized\
**Created:** [November 19, 2005, 5:00am UTC](https://forum.kirupa.com/t/redundant-code-help/169773 "2005-11-19T05:00:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flash\_noob1](https://avatars.discourse-cdn.com/v4/letter/f/8e7dd6/32.png) [@flash\_noob1](https://forum.kirupa.com/u/flash_noob1)\
**Post date:** [November 19, 2005, 5:00am UTC](https://forum.kirupa.com/t/redundant-code-help/169773/1 "2005-11-19T05:00:52Z")

</div>

Can someone consolidate this code:

Maybe as a funtion or something.

I know there has to be a better way of doing this. Im not very good at AS.  
Ill offer you 10-15 bucks for the first person who can give me a working answer. Thanks for your time! I have lot of other stuff I need help with too.

Thanks!

// TEACHING QUESTIONS  
if (\_root.TQ1Completed == “6”) {  
TQcheckMark1.\_visible = true;  
} else {  
TQcheckMark1.\_visible = false;  
}  
if (\_root.TQ2Completed == “5”) {  
TQcheckMark2.\_visible = true;  
} else {  
TQcheckMark2.\_visible = false;  
}  
if (\_root.TQ3Completed == “4”) {  
TQcheckMark3.\_visible = true;  
} else {  
TQcheckMark3.\_visible = false;  
}  
if (\_root.TQ4Completed == “3”) {  
TQcheckMark4.\_visible = true;  
} else {  
TQcheckMark4.\_visible = false;  
}  
if (\_root.TQ5Completed == “4”) {  
TQcheckMark5.\_visible = true;  
} else {  
TQcheckMark5.\_visible = false;  
}

The “numbers” correspond to the number of sections in the question.  
For example “TQ1Completed” has “6” sections and so on.
