Richard -- ...and then Richard Whitney said... % % Braindead!
Hey, who are you callin' names?!?
%
% I need to evaluate a number if greater than 7 and add a value per increment.
Greater than seven is easy. Adding a value is easy. Per increment can
be a little tricky but we'll assume for the moment that the window is 1.
The code
$sum = 67 ; # starting value
$trg = 7 ; # trigger value
$add = 6 ; # what we add each time
$num = 10 ; # what we're evaluating (hardcoded here!)
for ( $num ; $trg < $num ; $trg++ )
{ $sum += $add ; }
print "when num = $num, sum = $sum\n" ;
should do for a starting point, though, and produces
bash-2.05a$ php -q /tmp/inc.php
when num = 10, sum = 85
bash-2.05a$ php -q /tmp/inc.php
when num = 20, sum = 145
bash-2.05a$ php -q /tmp/inc.php
when num = 7, sum = 67
bash-2.05a$ php -q /tmp/inc.php
when num = 1, sum = 67
when run.
Extra credit if you write it as a recursive function :-)
% I'm frazzled and can't think straight.
You can't ask straight, either :-) Give us more details!
%
% Thanks Guys!
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
pgp00000.pgp
Description: PGP signature

