Nesting

If doesn't fit into any other category ....
Post Reply
BeanieBots
Posts: 325
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 173 times
Been thanked: 104 times

Nesting

Post by BeanieBots »

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.
User avatar
Electroguard
Posts: 836
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 268 times
Been thanked: 317 times

Re: Nesting

Post by Electroguard »

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.
User avatar
cicciocb
Site Admin
Posts: 1899
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1269 times
Contact:

Re: Nesting

Post by cicciocb »

Hi,
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.
BeanieBots
Posts: 325
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 173 times
Been thanked: 104 times

Re: Nesting

Post by BeanieBots »

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.
Post Reply