There must be a better way

Emp empty at
Tue Aug 1 18:57:07 PDT 2006

I wrap two values (x && y coordinates) like this:

uint wrap(uint axis, int value)
 int max=0;
 if (axis==1) max=25;
 if (axis==0) max=10;
  return (value % max);
  int newValue;
  return (newValue);
return value;

So I need to do things like 'wrap(0,currentX)' everytime to wrap the
currentX. Like:

(the original x && y need to be untouched)

Is this really the best way, or am I just missing some nifty D

Two small questions:
1. Isn't inout more used than out for functions, in contrast to what the
website says?
    I use inout quite often, or am I just doing something wrong?

2. Is it really difficult to make '>=" correctly compare an unsigned and a
signed int?
    (This took me some time to find out :)

Grtz, Emp

More information about the Digitalmars-d-learn mailing list