Name Spaces

Name space is a scope within which an identifier must be unique. The mikroPascal PRO for PIC uses two distinct categories of identifiers:

  1. Global variables are visible throughout the whole unit, from the place of declaration. Also. they can be seen in other units, if they are declared above the Implementation section.
  2. Local variables, parameters, types, function results - must be unique within the block in which they are declared.

For example:

var level : byte;

procedure control(sens : byte);
  var location : byte;
  begin
    location := 1;
    sens := location;
    level := 123;
  end;

procedure temperature;
  begin
    location := 0; // ILLEGAL
    sens := 23;    // ILLEGAL: redefinition of sens
    level := 95;
  end;
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code