# Positive variable?

**URL:** https://forum.kirupa.com/t/positive-variable/294891
**Category:** Uncategorized
**Created:** [August 21, 2009, 3:41pm UTC](https://forum.kirupa.com/t/positive-variable/294891 "2009-08-21T15:41:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dedaguy](https://avatars.discourse-cdn.com/v4/letter/d/ba8739/32.png) [@dedaguy](https://forum.kirupa.com/u/dedaguy)
#### Post date: [August 21, 2009, 3:41pm UTC](https://forum.kirupa.com/t/positive-variable/294891/1 "2009-08-21T15:41:07Z")

</div>

Let me start off by saying I’m a noob to AS in general but I am doing quite wll for just learning from tuts. Also I’m a little bit stoopid… but, aren’t we all from time to time?

Here’s my problem, building a photo gallery and I want my variable to always be a positive whole number, here’s the code for the buttons using UIimage loader etc.

var dinnerImageNum:Number = 1

function forwardImage (evtObj:MouseEvent):void{  
//adding to the variable number, dinnerImagenum  
dinnerImageNum++;  
//using the variable container  
standardImageLoader.source = “gallery/dinner/dinner”+dinnerImageNum+".jpg";

}

function backImage (evtObj:MouseEvent):void{  
//subtracting from the variable number, dinnerImagenum  
dinnerImageNum–;  
standardImageLoader.source = “gallery/dinner/dinner”+dinnerImageNum+".jpg";

}

How do I make my var dinnerImageNum always equal to or greater than 1?

Was watching the lynda tuts, can ya tell?
