16
Technical support / Re: goto command
« on: December 21, 2022, 12:00:30 AM »
Hi Gary
Thanks for the helpful response. Yes I understand your approach and it was a way I originally considered and the reason I was looking for a more simplified textual layout was because within the code sections there are / would be, many more nested ifs. In my example I only showed if branches for 1,2,3 and 10 but in reality there will be about 35 - 40 branches. So my thinking was that by using the goto command I would achieve two things. Firstly all the multiple if / elif / elseif chain would be reduced to one simple line that just reads - goto @xx where xx represents the sequence number. Secondly all the code for each section would then be headed with a @xx and this in my mind grouped in simple chunks of text, each sequentially following the other until coming to the last ‘@40’ label. I realise you get this as I have always been impressed with your many posts over the years so I am really only explaining this in more detail for others who may be wondering what an why I am wittering on about. As so often happens, the process of posting a tech question makes one re-evaluate ones thought process. With this in mind it may be better for me to call up say 40 custom functions from the if elseif chain and segregate my code by custom function rather than by a goto label. Any thoughts ?
Once again thanks for your help
All the best
Pete
Thanks for the helpful response. Yes I understand your approach and it was a way I originally considered and the reason I was looking for a more simplified textual layout was because within the code sections there are / would be, many more nested ifs. In my example I only showed if branches for 1,2,3 and 10 but in reality there will be about 35 - 40 branches. So my thinking was that by using the goto command I would achieve two things. Firstly all the multiple if / elif / elseif chain would be reduced to one simple line that just reads - goto @xx where xx represents the sequence number. Secondly all the code for each section would then be headed with a @xx and this in my mind grouped in simple chunks of text, each sequentially following the other until coming to the last ‘@40’ label. I realise you get this as I have always been impressed with your many posts over the years so I am really only explaining this in more detail for others who may be wondering what an why I am wittering on about. As so often happens, the process of posting a tech question makes one re-evaluate ones thought process. With this in mind it may be better for me to call up say 40 custom functions from the if elseif chain and segregate my code by custom function rather than by a goto label. Any thoughts ?
Once again thanks for your help
All the best
Pete