Shop OBEX P1 Docs P2 Docs Learn Events
Question on Basic program — Parallax Forums

Question on Basic program

tigershark35tigershark35 Posts: 60
edited 2006-07-16 20:20 in BASIC Stamp
Hi.

Here is a piece of a program and I get an error that I don't understand.

GOSUB findtimes
DEBUG CR, "HERE"
IF time1 > timeref1· THEN
GOSUB Sub_up
· else
IF time1 < timeref1·· THEN
GOSUB Sub_down
· else
·· END IF
·· END IF

When I run it, I get an error "expected label"·after the first "then".· Do I have to declare the·subroutine names?

Any help will be appreciated.

JG

Comments

  • willthiswork89willthiswork89 Posts: 359
    edited 2006-07-16 02:12
    the subroutines should be declared after the end of the program like

    ...
    END

    Sub_up:
    do stuff
    RETURN

    Sub_Down:
    do stuff
    RETURN
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-16 05:22
    JG,

    ·· My guess is you don't have a PBASIC 2.5 directive in your code.· You can insert it from the Directive Menu, PBASIC, then 2.5 or click the icon that says 2.5 on your toolbar.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • tigershark35tigershark35 Posts: 60
    edited 2006-07-16 20:20
    Thanks. That did it. I had been using the 2.0.



    I just sent an email to Support on the subject before I saw your reply here.· I did the controlT and did not get the error.·

    Jim G.
Sign In or Register to comment.