Welcome, Guest. Please login or register.

Author Topic: AmigaBASIC structural question...  (Read 628 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline blakespotTopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2003
  • Posts: 872
  • Country: us
  • Thanked: 8 times
  • Gender: Male
  • Visit ByteCellar.com
    • Show only replies by blakespot
    • ByteCellar - The Vintage Computing Blog
AmigaBASIC structural question...
« on: October 11, 2013, 10:13:16 PM »
I've got a question for anyone that ever played around with AmigaBASIC. (Not ABasiC, but AmigaBASIC that came after.)

I have a program that is doing some GOSUBs to a subroutine. Inside that subroutine, I need to do a GOTO to a sub-section of the subroutine code, depending on a variable state. How is this done, with labels?

I try:

MySubroutine:
x=0:y=0
read x,y....blabla
...
...
...
...
if x > whatever then goto (that read line above)
RETURN

Whenever I change that read line to...

ReadLine: read x,y .....blablabla

and then...

...goto ReadLine

I get undefined routine error. Not wanting to use line numbers for this - AmigaBASIC wasn't setup for that, really.

Basically, how does on goto inside a subroutine, is the question?

Thanks!





bp
:: ByteCellar.com - The Vintage Computing Weblog
:: Amigas: 1000, 2000 '020, SAM440ep-Flex
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show only replies by itix
Re: AmigaBASIC structural question...
« Reply #1 on: October 11, 2013, 10:21:42 PM »
I have no experience with AmigaBASIC but you should use while statement instead.
My Amigas: A500, Mac Mini and PowerBook
 

Offline ElPolloDiabl

  • Hero Member
  • *****
  • Join Date: May 2009
  • Posts: 1702
    • Show only replies by ElPolloDiabl
Re: AmigaBASIC structural question...
« Reply #2 on: October 12, 2013, 03:20:49 AM »
Do the goto on the next line:

IF x >
THEN GOTO subroutine
END IF
Go Go Gadget Signature!
 

Offline Minuous

Re: AmigaBASIC structural question...
« Reply #3 on: October 12, 2013, 05:23:10 AM »
>Whenever I change that read line to...

>ReadLine: read x,y .....blablabla

IIRC labels need to be on their own separate line.
 

Offline Thorham

  • Hero Member
  • *****
  • Join Date: Oct 2009
  • Posts: 1149
    • Show only replies by Thorham
Re: AmigaBASIC structural question...
« Reply #4 on: October 12, 2013, 07:00:25 AM »
Quote from: ElPolloDiabl;749870
Do the goto on the next line:

IF x >
THEN GOTO subroutine
END IF

Learn to do it right, and use while instead of goto :p