[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GSoft Basic subroutine



  To: limtc
On Thu, 1 May 2008 01:13:18 -0700, limtc wrote:

> Written a few demos using HGR and QuickDraw, all works fine, however,
> when I try to use SUB as subroutines, I got error.
> 
> Just above my program, I try a simple test (don't care what it means
> first):
> 
> SUB GR
>   HGR
> END SUB
> 
> But running it immediately returns a "Syntax error >>> SUB GR"! I also
> try other name like INIT and it is the same, so it is not about
> reserved words. I read the GSoft Basic manual and subroutine is indeed
> declare as SUB, so what am I doing wrong?

The only way I could get the code to run was to make sure there was code
before the SUB.  This worked:

CALL Init
GET A$
END
SUB Init
	HGR
END SUB

but this code didn't work:

SUB Init
	HGR
END SUB
CALL Init
GET A$
END

I'm not sure where my GSoft manual is at present so I can't look up what
restrictions there are for using SUB/FUNCTION statements but at first
glance I'd say that you aren't allowed to have code that isn't in a SUB
or FUNCTION after the first SUB or FUNCTION statement appears.
--- Synchronet 3.14a-Win32 NewsLink 1.85
A2Central.com - Your total source for Apple II computing.