FreePascal Information Logo Friend of FreePascal Compiler Title
Articles with Feedback, FPC News Library, PDF Collection, Mail Lists, Books, Newsgroups, IRC Open online discussion areas Research and Tutorials Tools, Compilers and Utilities Blurbs about us, advertising, etc.
Welcome to the FoFPC Pascal Language DOWNTO

downto


     The DownTo keyword prefixes the target value Expression in a For loop. The DownTo expression maybe an Integer, Character or Enumeration type.

     For more details, see the keyword for. The example illustrate the three expression types.

Example

    Download Source IconDownload This Source for Free Pascal
var
  i : Integer;
  c : char;
  suit : (Hearts, Clubs, Diamonds, Spades);

begin
  // Loop 5 times
  for i := (10 div 2) DownTo 1 do Writeln('i = ',i);

  // Loop 5 times
  for c := 'E' DownTo 'A' do Writeln('c = ',c);

  // Loop 3 times
  for suit := Diamonds DownTo Hearts do
    Writeln('Suit = ',Ord(suit));
end.

Output

i = 5
i = 4
i = 3
i = 2
i = 1
c = E
c = D
c = C
c = B
c = A
Suit = 2
Suit = 1
Suit = 0

See Also

Begin, End, For, To.
 Links and Products we find useful



ButtonGenerator.com
Valid XHTML 1.0 Transitional Internet Map
Programmer's Heaven
grat-i-fi-ca-tion - noun
the state of being gratified; great satisfaction.


"Friends of Free Pascal is, in my view, one of the best things to happen to FPC since the compiler first appeared"

Gary Funk
BoardWatch Magazine
Locations of visitors to this page world map hits counter
Copyright 2009 by 3F, LLC. All rights reserved. Worldwide.
Your request was processed by server #3 in 0.003332 secs.

sponsor
This sponsor helps us with our documentation