Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1642
Posted: 01:19am 29 May 2019
Copy link to clipboard
Print this post
Hi Peter,
You must have a reason for the 'GOTO X'. I think GOTOing out of an IF..THEN sequence is problematical because the interpreter will be looking for an ENDIF and not finding one. Why not set a flag and test it after the ENDIF?
BillKeep safe. Live long and prosper.
PeterB Guru Joined: 05/02/2015 Location: AustraliaPosts: 655
Posted: 02:59am 29 May 2019
Copy link to clipboard
Print this post
Hi Bill
My bit of code is meant to show the problem only. The manual claims GOTO can be used and that bothers me because you could be out West of the Black Stump. That's why I tried a GOSUB / RETURN. That at least takes you back to where you started. You and I are now communicating on two topics
Peter
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1642
Posted: 03:20am 29 May 2019
Copy link to clipboard
Print this post
G'Day Peter,
Yes, GOTO can be used in a single line IF statement but not in a multi-line one (one with IF THEN ELSE etc.). GOSUB / RETURN is good for the reason you say and the interpreter won't lose the ENDIF.
Thanks for the info on the other thread. I have an iphone and am of that age - I will check it out.
BillKeep safe. Live long and prosper.
PeterB Guru Joined: 05/02/2015 Location: AustraliaPosts: 655
Posted: 03:42am 29 May 2019
Copy link to clipboard
Print this post
Well done Bill (again)
Yes, it's b8888y obvious when it is explained.
Peter
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4044
Posted: 09:31am 29 May 2019
Copy link to clipboard
Print this post
I too would expect it to throw an error.
Perhaps too tough for the interpreter to do, sadly.
It clearly does know not to run the code in the ELSE part when it shouldn't.