# \[AS2\] How should I clean up my code?

**URL:** <https://forum.kirupa.com/t/as2-how-should-i-clean-up-my-code/306973>\
**Category:** programming\
**Created:** [March 25, 2010, 2:37pm UTC](https://forum.kirupa.com/t/as2-how-should-i-clean-up-my-code/306973 "2010-03-25T14:37:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [March 25, 2010, 2:37pm UTC](https://forum.kirupa.com/t/as2-how-should-i-clean-up-my-code/306973/1 "2010-03-25T14:37:22Z")

</div>

Hey guys, just need a little help cleaning my code. It messy, but I don’t know what other way to make it simpler. Any help would be appreciated.

```auto
	if(eElem == "Neutral") {
	_root.playerMinDmg = Math.round((_root.strBonus+_root.playerstr)/1*0.8+_root.wepMinDmg);
	_root.playerMaxDmg = Math.round((_root.strBonus+_root.playerstr)/1*1.6+_root.wepMaxDmg);
	} else if (pElem == eContrastElem) {
		_root.playerMinDmg = Math.round((_root.strBonus+_root.playerstr)/1*0.8+_root.wepMinDmg);
	_root.playerMaxDmg = Math.round((_root.strBonus+_root.playerstr)/1*1.6+_root.wepMaxDmg);
		playerMinDmg = Math.round(playerMinDmg *= 2);
		playerMaxDmg = Math.round(playerMaxDmg *= 2);
	} else if (pElem == eAdvElem) {
		_root.playerMinDmg = Math.round((_root.strBonus+_root.playerstr)/1*0.8+_root.wepMinDmg);
	_root.playerMaxDmg = Math.round((_root.strBonus+_root.playerstr)/1*1.6+_root.wepMaxDmg);
		playerMinDmg = Math.round(playerMinDmg /= 2);
		playerMaxDmg = Math.round(playerMaxDmg /= 2);
	}

```

Thanks.
