| View previous topic :: View next topic |
| Author |
Message |
pantagruel
Joined: 08 Oct 2006 Posts: 91 Location: denmark
|
Posted: Wed Jul 09, 2008 7:20 pm Post subject: recursive function quits after 270 recursions? |
|
|
Hi,
I have a recursive function:
| Code: | #a:: sender(329,1000)
sender(fromnum,tonum){
if(fromnum < tonum){
Send x
Send %fromnum%
Send {Enter}
sender(fromnum + 1,tonum)
}
} |
it quits at printing x599.
I could understand it if I was concatenating a string, or it operated on a recursive structure, but all it does is call itself as long as the first parameter is less than the second. |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1259 Location: Denmark
|
Posted: Wed Jul 09, 2008 8:17 pm Post subject: |
|
|
Limited stackspace. Rewrite without:
| Code: | #a::sender(329,400)
sender(fromnum,tonum){
if (fromnum < tonum)
{
loop % tonum - fromnum
{
Send x
Send %fromnum%
Send {Enter}
fromnum++
}
}
} |
_________________ there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face
- Kashmir |
|
| Back to top |
|
 |
|