On Thu, 22 Dec 2011 15:33:13 -0500 Timothy Groves <the.tail.kin...@gmail.com> wrote:
> Can anyone think of a situation in which you would *have* to use forward > declared functions? I'm trying to come up with an example for such for > my book, and I am drawing a blank. Traverse a html tree. For example with div and p nodes. Both div and p nodes can have children that are div and p nodes. procedure Proc(RootNode: TNode); procedure ReadChildrenv(Node: TNode); forward; procedure ReadP(Node: TNode); begin ... ReadChildren(Node); end; procedure ReadDiv(Node: TNode); begin ... ReadChildren(Node); end; procedure ReadChildren(Node: TNode); begin for Child in Node do begin if Child is Div then ReadDiv(Child) else if Child is P then ReadP(Child); end; end; begin ReadChildren(RootNode); end; Mattias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal