Re: Coming From QBasic
- Posted by Chris Burch <chriscrylex at aol.com> Jan 16, 2006
- 535 views
Lynn Kilroy wrote: > > Would it be possible to rename these functions? I assume they're function,= > > by the way they're formatted. Also, could they perhaps be converted to > subroutines? I tended to put QBasic Functions in subroutines because I > preferred the Subroutine Format over the Function Format. > > Love & Friendship & Blessed Be! > Lynn Erika Kilroy > > > >From: Chris Burch <guest at RapidEuphoria.com> > >Reply-To: EUforum at topica.com > >To: EUforum at topica.com > >Subject: Re: Coming From QBasic > >Date: Mon, 16 Jan 2006 00:49:50 -0800 > > > > > >posted by: Chris Burch <chriscrylex at aol.com> > > > > > >hi > > > >integer c > > > >c = get_key() > > > >returns -1 if nothing pressed > > > > > ><a > >href="http://members.aol.com/chriscrylex/euphoria.htm">http://members.aol.com/chriscrylex/euphoria.htm</a> > ><a href="http://uboard.proboards32.com/">http://uboard.proboards32.com/</a> > ><a > >href="http://members.aol.com/chriscrylex/EUSQLite/eusql.html">http://members.aol.com/chriscrylex/EUSQLite/eusql.html</a> > > > > Hi Ah ha - the goto / gosub/return argument again. Short answer no - look through the mailing list archives for all the pro and con arguments. Assume there are no subroutines - in the qbasic sense. When you get used to euphoria, its far prettier and easier to read. As with most things euphoria, there are work arounds functions - return a value procedures - do not return a value both need to to be found in your program (in the way the program is read), before you actually call them (can use routine_ids, but keep it simple for now) The 'preferred' method is to only use local variables to your functions/procedured, as this leads to prettier, more re usable code, eg
function foo(integer x) integer y y = x * 2 return y end function integer z z = foo(2)
now if you used untidy global variables (bad programming practice (hands up those who NEVER do it))
integer y, z procedure foo(integer x) y = x * 2 end procedure foo(4) z = y
yeuch, horrible. Is this what you meant. Also say goodbye to on x gosub/goto, and switch/case statements (are these in qbasic?) Chris http://members.aol.com/chriscrylex/euphoria.htm http://uboard.proboards32.com/ http://members.aol.com/chriscrylex/EUSQLite/eusql.html