View Single Post
  #4  
Old 08-25-2009, 08:18 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Well I'm not entirely sure if limit is the right name for it but that's how I always thought of it.

I found it first in Zodiac's initial code by Yen, it looked something like this.

PHP Code:
function limit(valminmax) {
  if (
val min) return min;
  else if (
val max) return max;
  else return 
val;

But it's come in handy for me when I am validating quantities i.e:

temp.donation = limit(temp.value, 0, player.rupees)

Or other statistic related code.
__________________
Quote:
Reply With Quote