Arrays elements value limit

Hi, I am quite new to programming.Please pardon me.

I have created a new array and have wrote a code which will decrease || increase the value of the array element.
I been trying to figure out how to set the value limit.
For Example:

int[] stock = new int[] { 10, 10, 10, 10 };

How to set a limit on the elements that they will never go
below to the negative integers and over 10?

Any reply is greatly appreciated.
Thank You.



Can't you just use a simple if statement before you change the value, to check that the new value isn't outside those bounds?
Topic archived. No new replies allowed.