home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / compiler / vici_102 / examples / arrtst.e next >
Text File  |  1993-03-13  |  482b  |  33 lines

  1. CLASS ARRTST
  2. FEATURE
  3.   a: array[integer];
  4.  
  5. create is
  6. local i:integer
  7. do
  8.   a.create(1,10);
  9.   io.putint(a.lower);
  10.   io.putint(a.upper);
  11.   from i:= a.lower
  12.   invariant ForAll j: [a.lower .. i-1].a.item(j)=j
  13.   variant a.upper - i + 1
  14.   until i > a.upper
  15.   loop
  16.     a.put(i,i);
  17.     i:=i+1
  18.   end;
  19.  
  20.   io.new_line;
  21.   from i:=a.upper
  22.   variant i + a.lower + 1
  23.   until i < a.lower
  24.   loop
  25.     io.putint(a.item(i));
  26.     io.new_line;
  27.     i:=i-1;
  28.   end;
  29. end
  30. end
  31.  
  32.  
  33.