Re: How to calculate/process this one?
Re: How to calculate/process this one?
- Subject: Re: How to calculate/process this one?
- From: Jean-Baptiste Le Stang <email@hidden>
- Date: Sat, 27 Apr 2002 22:45:14 +0200
One way of solving you problem of would "error telling me
that X cannot be made into an integer" would to check wether or not the sum
of your two last numbers is greater or not than 10. If so, you use one more
time your trick of adding thoose two numbers. As your numbers are between 0
and 9, the higher sum you coul get would be 18, that gives 1+8=9. O more
problem.
Jean-ba^tiste LE STANG
>
Hi,
>
>
thanks to everybody who posted routines so far. I do not yet know how
>
they all work in detail, some of them are doing stuff I have never seen.
>
I guess it is time for taking another learning lesson.
>
>
So far there are only two problems:
>
>
1) The one that MrTea mentioned: Sometimes I get an error telling me
>
that X cannot be made into an integer.
>
b) Sometimes the numbers are not getting smaller and smaller by the time
>
but bigger and bigger. I do not know how to get rid of this problem.
>
>
Please, don't get me wrong: I am very happy that all of you are trying
>
to help me and I appreciate your efforts a lot. After all, it is
>
saturday ;-) But I did not much calculating with AppleScript in the
>
past, so I do not know how to solve my problems.
>
>
With very kind regards,
>
>
Martin
>
>
Please excuse my English, I am not a native speaker.
>
>
Am Samstag den, 27. April 2002, um 15:44, schrieb Jean-Baptiste Le Stang:
>
>
>> Hi,
>
>>
>
>> I have a problem thinking of a routine which does the following:
>
>>
>
>> Let's say I have a random number like 11050. Now I want to add each
>
>> pair
>
>> of consecutive digits to give the next line (so 11050 becomes 2155). I
>
>> want to repeat this step until I have a two-digit number.
>
>>
>
>> I tried over and over again but did not find a solution for this
>
>> problem.
>
>>
>
>> Anybody out there who could help me?
>
>>
>
>> With very kind regards,
>
>>
>
>> Martin
>
>> _______________________________________________
>
>> applescript-users mailing list | email@hidden
>
>> Help/Unsubscribe/Archives:
>
>> http://www.lists.apple.com/mailman/listinfo/applescript-users
>
>> Do not post admin requests to the list. They will be ignored.
>
>
>
> Try the following
>
>
>
> set mynum to 11050 as string
>
> set newnum to ""
>
>
>
> repeat with x from 1 to (count mynum) - 1
>
> set newnum to newnum & (((item x) of mynum) + ((item (x + 1)) of
>
> mynum)
>
> as string)
>
> end repeat
>
>
>
> repeat until (newnum as integer < 100)
>
> set mynum to newnum
>
> set newnum to ""
>
> repeat with x from 1 to (count mynum) - 1
>
> set newnum to newnum & (((item x) of mynum) + ((item (x + 1)) of
>
> mynum) as string)
>
> end repeat
>
> end repeat
>
>
>
> JB Le Stang
>
> _______________________________________________
>
> applescript-users mailing list | email@hidden
>
> Help/Unsubscribe/Archives:
>
> http://www.lists.apple.com/mailman/listinfo/applescript-users
>
> Do not post admin requests to the list. They will be ignored.
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.