# Help W/ AS (if statements)

**URL:** <https://forum.kirupa.com/t/help-w-as-if-statements/50622>\
**Category:** flash\
**Created:** [May 4, 2004, 10:28pm UTC](https://forum.kirupa.com/t/help-w-as-if-statements/50622 "2004-05-04T22:28:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soul814](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@Soul814](https://forum.kirupa.com/u/Soul814)\
**Post date:** [May 4, 2004, 10:28pm UTC](https://forum.kirupa.com/t/help-w-as-if-statements/50622/1 "2004-05-04T22:28:41Z")

</div>

Okay, any clues why the third if statement is never accessed and it accesses the first one whne the statement isnt true? DOWNLOAD --\> [LINK](http://www.silver.ppnhosting.net/hosted/attackstat.zip)

```auto
hp = 1000000;
atk = 10;
enemydef = 200;
function dmg() {
	if (_root.atk>_root.enemydef) {
		_root.damage = int(_root.atk+(Math.random()*(_root.atk/2)))-(_root.enemydef+(Math.random()*(_root.enemydef/2)));
		_root.hp -= _root.damage;
	}
	if (_root.atk == _root.enemydef) {
		_root.damage = int(((_root.atk/2)*Math.random())+(_root.atk/4));
		_root.hp -= _root.damage;
	}
	if (_root.atk<_root.enemydef) {
		// It never goes here...
		_root.damage = int(((_root.atk/2)*Math.random())-(Math.random()*(_root.enemydef-_root.atk))+(_root.atk/4));
		if (_root.damage<0) {
			_root.damage = int(Math.random()*2);
		}
		_root.hp -= _root.damage;
	}
}
stop();

```
