I need help with one of my best projects. I'm creating a programming language in S c r a t c h and I need some code help with detecting loops.
Offline
Rocker98585 wrote:
I need help with one of my best projects. I'm creating a programming language in S c r a t c h and I need some code help with detecting loops.
It's a little hard to help without having any idea the system you already have implemented...a system I might use though is an "end" counter. Basically, you have a variable that counts up the number of "ends" it should reach based off lines of code that would initiate an "end" such as a block if, forever, if-else, repeat, repeat until, etc. Then you could have a list that lists what the next "end" (the last item on a list) corresponds to, like a repeat. Once the item is used all the way up (condition is met or iterations are met or script is stopped), it deletes that item from the list and moves to the next one. You could have a 3 list system as well so that you could have the number of iterations a repeat must do and the amount it has done stored as well.
Offline