Re: How can I format an integer ?
Re: How can I format an integer ?
- Subject: Re: How can I format an integer ?
- From: Luther Fuller <email@hidden>
- Date: Tue, 4 Nov 2008 18:02:14 -0600
On Nov 4, 2008, at 5:22 PM, Philip Aker wrote:
Thanks Barry, using recursion seems like a more logical approach.
on FormatInt(theNum, theSeparator)
if theNum > 999 then return (FormatInt(theNum div 1000,
theSeparator) & theSeparator & text -3 thru -1 of ("00" & ((theNum
mod 1000) as text)))
return theNum as text
end FormatInt
FormatInt(9.99999999E+8, ",")
I must disagree. Many years ago, I was asked to teach a Fortran
programming course as an introduction to programming for CS students.
In such a course, one arrives at the subject of "recursion".
Explaining this to some students is not easy. The text book invariably
gives the example of calculating the value of n!. This works only for
small values of n and is very misleading. It is much more efficient to
calculate n! with a loop. Very bad example.
So ... Don't do anything with recursion if you can avoid it.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden