turn off global variables

Quote
> I am a high school teacher working with TP 7.0.  I have noticed that
> when variables are declared, they are by global by default, and don't
> need to be passed to procedures and functions.  Is there a way to turn
> this off so that all variables MUST be passed to procedures and
> functions? I am trying to teach young people good programming habbits.

One way to have global variables (which will be needed to pass
parameters to functions or procedures) not accessible to these
subprograms is to declare them after you declare the subprograms.  
This is allowed in Turbo Pascal (but not in standard Pascal).

program name;

const....     (* put needed global CONST and TYPE definitions here *)
type ....

procedure that (parm: integer);
begin
  (* procedure that must use only its parameters, since no
     other (global) variables have been declared. *)
end;

var     (* Put global declarations down here *)
  a: integer;  

begin (* main *)
  that (a);
  ...
end.

Hope this helps.
Greg Shubert     gshub...@fc.hp.com