Besides memory, are there any limits to nesting?
In particular Gosubs, but it would be good to know if there are any limits to if/then, select/case, do/loop, etc. etc.
Nesting
-
- Posts: 344
- Joined: Tue Jun 21, 2022 2:17 pm
- Location: South coast UK
- Has thanked: 179 times
- Been thanked: 112 times
- Electroguard
- Posts: 852
- Joined: Mon Feb 08, 2021 6:22 pm
- Has thanked: 273 times
- Been thanked: 321 times
Re: Nesting
There are stack limits to how many times you can push things without pulling, such as branching without returning.
I would guess at 255 - but why not test them for yourself by wlogging a running count of how many times you can call a gosub from itself, or any of the other things you mention, which could provide quick definitive answers.
I would guess at 255 - but why not test them for yourself by wlogging a running count of how many times you can call a gosub from itself, or any of the other things you mention, which could provide quick definitive answers.
- cicciocb
- Site Admin
- Posts: 1978
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 425 times
- Been thanked: 1320 times
- Contact:
Re: Nesting
Hi,
yes there are some limits
yes there are some limits
- FOR / NEXT -> 32
- GOSUB -> 8
- SELECT / CASE -> 4
for the other items, there are no limits but this will change in the future as I'm working into optimizing the interpreter, in particular for the speed.
-
- Posts: 344
- Joined: Tue Jun 21, 2022 2:17 pm
- Location: South coast UK
- Has thanked: 179 times
- Been thanked: 112 times
Re: Nesting
Thanks for the quick reply. Thought that was the case, I got bitten!
Good to know the numbers.
Would be nice if it could be added to the documention at some point.
Good to know the numbers.
Would be nice if it could be added to the documention at some point.