gawk: Do Statement

1 
1 7.4.3 The 'do'-'while' Statement
1 --------------------------------
1 
1 The 'do' loop is a variation of the 'while' looping statement.  The 'do'
1 loop executes the BODY once and then repeats the BODY as long as the
1 CONDITION is true.  It looks like this:
1 
1      do
1        BODY
1      while (CONDITION)
1 
1    Even if the CONDITION is false at the start, the BODY executes at
1 least once (and only once, unless executing BODY makes CONDITION true).
1 Contrast this with the corresponding 'while' statement:
1 
1      while (CONDITION)
1          BODY
1 
1 This statement does not execute the BODY even once if the CONDITION is
1 false to begin with.  The following is an example of a 'do' statement:
1 
1      {
1          i = 1
1          do {
1              print $0
1              i++
1          } while (i <= 10)
1      }
1 
1 This program prints each input record 10 times.  However, it isn't a
1 very realistic example, because in this case an ordinary 'while' would
1 do just as well.  This situation reflects actual experience; only
1 occasionally is there a real use for a 'do' statement.
1