previous  next
2.7.10. Another Example Using Tags
Here is one more example using tags.  Note that CoCoA commands that
do not have to do with printing ignore tags.

Example

N := Tagged(4,'Dots');
N;
4
-------------------------------
Define Print_Dots(X)
  For I := 1 To X Do
    Print '.'
  EndFor
EndDefine;
N;
....
-------------------------------
N+N;  -- As long as printing is not involved, N is treated as if
      -- it has no tag.  In this case, the sum of two tagged objects
      -- returns an integer, not another tagged object.
8
-------------------------------
M := Tagged(12,'Dots');
M;
............
-------------------------------