Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Round to nearest 5
Message
From
25/01/2005 07:54:55
 
 
To
25/01/2005 07:49:17
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00980330
Message ID:
00980339
Views:
26
Me, Terry McKludge. On the other hand, aren't VFP functions only kludges in the background really? And once you've declared the func. it is no more kludgy than calling a ready-made function.

>Hi Terry. Yeah, I have something like this but I think it's a kludge and am hoping that someone has a one (or two) liner :)
>
>
>
>>Jos, haven't tested this but something like:
>>
>>
>>* to find the NEXT higher number to meet the criteria
>>FUNCTION Blah
>>LPARAM   tnNum
>>
>>lnNum = tnNum
>>
>>If MOD( lnNum, 5) <> 0
>>    Do while not llFound
>>      lnNum = lnNum + 1
>>      If CEILING( MOD( lnNum, 5) = 0
>>          llFound = .T.
>>      Endif
>>    EndDO
>>endif
>>Return lnNum
>>
>>
>>HTH but Sergey will probably come up with a one-liner later! :-)
>>
>>Terry
>>
>>>Hi All,
>>>
>>>Having a bit of a brain freeze here...I have an integer between 0 and 100. I want to round it to the nearest integer wholly divisible by 5 i.e. 0,5,10,15,...95,100
>>>
>>>Sorry for the low quality challenge :)
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Previous
Reply
Map
View

Click here to load this message in the networking platform