# BUTTON with if else

**URL:** <https://forum.kirupa.com/t/button-with-if-else/301802>\
**Category:** flash\
**Created:** [December 16, 2009, 1:26am UTC](https://forum.kirupa.com/t/button-with-if-else/301802 "2009-12-16T01:26:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayusuits](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@ayusuits](https://forum.kirupa.com/u/ayusuits)\
**Post date:** [December 16, 2009, 1:26am UTC](https://forum.kirupa.com/t/button-with-if-else/301802/1 "2009-12-16T01:26:33Z")

</div>

My code is not working properly. The subtracting thing should only work if the text is 1 or higher.

Could somebody help me:

```php
button1.onPress = function() { 
	if (voca_pg1.text > 0){
		voca_pg1.text=parseInt(voca_pg1.text)-10
		voca_pg2.text=parseInt(voca_pg2.text)-10
	}
	else if (voca_pg1.text < 0){
		voca_pg1.text = "1"
		voca_pg2.text = "11"
	}
};

```

When I click the button it goes -9 - -11

then when I click again it goes back to what I want 1 - 11
