Re: Those of us who are C'ly challenged :>
- Posted by Falkon <Falkn13 at IBM.NET> Jul 18, 1998
- 629 views
From: Nate Brooman >It's just that I was always told to code 1 step at >a time. For example, in QBasic, if I want to code a program, I structurize >it: [code snipped] Precisely. One step at a time. The only real difference in what you're describing is that QBasic requires you to declare the routines first, then comes the main program, then the routines' actual code; whereas in Euphoria, the routines come first, then the main program, with no declarations necessary. (except when bypassing that rule with routine_id() ) QB source looks like: <Declarations of routines which follow program> <Main Program> <Routines declared before program> EU source looks like: <Routines> <Main Program> Qbasic won't let you use undeclared routines either. (Technically, that is, actually it generates the declarations for you if you forget them, but in my experience it often gets the declarations wrong.) Benefits to Euphoria's 'stricter' structure are: 1. You (or the interpreter) can read code straight through, start to finish, and never come across something that hasn't been defined yet. The interpreter doesn't need to try to 'guess' what something will be, so it's more efficient. 2. You have more freedom to mix things up. All your routines don't have to come first or last, you can put main-level code before, between, or after routines, so long as everything which that bit of code uses already exists. 3. It discourages sloppy programming by encouraging you to know what the steps will be, and exactly what they will do, before you start writing the main program, rather than writing a program and then hacking parts of it off into routines. 4. It's a good deal easier to work with and better looking once you get used to it. (which won't take long)