Re: Variable declarations
- Posted by CoJaBo <cojabo at suscom.net> Sep 19, 2004
- 429 views
Greg Haberek wrote: > > I think thats one of the few things we all did when we started, along > with improperly initializing variables. > > we've all done these, i'm sure: > > }}} <eucode> > -- wrong: > integer myint = 5 It would be nice if Euphoria allowed this... It would save soem typing! > > -- right: > integer myint myint = 5 > > > -- wrong: > integer myint > myint += 5 --wrong Yup, I seem to forget to set the initial value of a variable about 99.9% of the time! > > -- right: > integer myint > myint = 0 > myint += 5 > </eucode> {{{ > > On Sat, 18 Sep 2004 15:34:41 -0700, CoJaBo <guest at rapideuphoria.com> wrote: > > > > posted by: CoJaBo <cojabo at suscom.net> > > > > Jim Hendricks wrote: > > > > > > Derek Parnell wrote: > > > > Yes, variables inside routines must be declared prior to the first > > > > executable statement in that routine. It is documented under the > > > > heading 'scope'... > > > > > > > > "Variable declarations inside a subroutine must all appear > > > > at the beginning, before the executable statements of the subroutine." > > > > > > > > -- > > > > Derek Parnell > > > > Melbourne, Australia > > > > > > Ah, thanks, my bad. I saw at the beginning of the scope section the > > > statement that all variables must be declared, but stopped reading the > > LOL :) I did the exact same thing when I first started! > > > > > > > section when it started in on naming conflicts since right now my > > > programs are simple enough that naming conflicts are not a problem and > > > I try to keep to local scope ( if that's the right EU terminology ) > > > which greatly reduces naming conflicts. > > > > > > Thanks also for the quick response! That will come in handy as I try > > > and wrap my mind around EU. > > > > > > Jim Hendricks > > > President > > > Biz Computing, Inc. > > > > >