[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

1671.0. "AMIGA BASIC" by TAGART::THOMPSON () Thu Sep 08 1988 08:33

		BASIC Syntax Error
    
    OK let's set the stage. It's been 8 years since I last did some
    real "creative" programming (Macro-11, RSX and 11/70's) and I've
    had my AMIGA running for just over 1 month. Just for a laugh I thought
    I'd try some BASIC stuff but have come upon an apparent syntax error
    that's just driving me mad. Example as follows:
    
    SUB Ticker STATIC
    SHARED .....
    [blah blah blah]
    END SUB
    
    Start:
    [blah blah blah]
    ON TIMER(1) GOSUB Ticker
    TIMER ON
    [blah blah blah]
    
    What am I trying to do? Simple, use subroutine Ticker to process
    1 second ASTs. If it works or not is unimportant at this time, I
    can't get past a SYNTAX error that claims UNDEFINED Subroutine.
    
    I've read the books, I've looked thru the mags and I've quickly
    searched the notes file for a similar situation, but no joy.
    
               -- Help, Doug.
                             
T.RTitleUserPersonal
Name
DateLines
1671.1Subroutine SorrowsRAVEN1::EVERHARTFri Sep 09 1988 19:5810
    I think I've found your problem.  AmigaBASIC has two distinct types
    of subroutines.  1. Traditional BASIC subroutines, and 2. Real
    Subroutines.  You are trying to use both at the same time in your
    program, which doesn't work.  When you set up a subroutine using
    the SUB statement, it becomes an actual command.  To correct your
    problem, change the GOSUB Ticker part to just plain old Ticker.
     I also suggest that you put all subroutines after the main program.
    (I think it looks better, and I know it works that way)
    
    Chris